me-no-dev / ESPAsyncWebServer

Async Web Server for ESP8266 and ESP32
3.61k stars 1.17k forks source link

ESP8266 goin down when get JSON string. #1398

Open sova32 opened 2 months ago

sova32 commented 2 months ago

ESP8266 goin down when get string. {"DataType":"CONTROL_DATA","pwm1Speed":"100","pwm2Speed":"1023"} another strings like {"DataType":"CONTROL_DATA","pwm1Speed":"0","pwm2Speed":"0"} work good no any modifications in example code! i get response from server and then microcontroller goin to reboot:

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 
tail 0
chksum 0x2b
csum 0x2b
v000945b0
~ld

this is js code that send string to server:

let socket = new WebSocket("ws://" + window.location.hostname + "/ws");

socket.onopen = function (e) {
    console.log("[open] Connection established");
};
function sendControlData() {
    let pwm1Speed = document.getElementById("control-pwm1Speed").value;
    let pwm2Speed = document.getElementById("control-pwm2Speed").value;

    // Перевірка введених даних
    if (!isValidNumber(pwm1Speed) || !isValidNumber(pwm2Speed)) {
        alert("Please enter valid numeric values for control data.");
        return;
    }

    let controlData = {
        DataType: "CONTROL_DATA",
        pwm1Speed: pwm1Speed,
        pwm2Speed: pwm2Speed,
    };

    socket.send(JSON.stringify(controlData));
}
noweare1 commented 1 month ago

Would need to see the esp32 code.