diff --git a/ConfigSettings.h b/ConfigSettings.h index 39ee605..4d28234 100644 --- a/ConfigSettings.h +++ b/ConfigSettings.h @@ -40,7 +40,7 @@ class WifiSettings: BaseSettings { WifiSettings(); // char hostname[32] = "ESPSomfyRTS"; char ssid[64] = ""; - char passphrase[32] = ""; + char passphrase[64] = ""; //bool ssdpBroadcast = true; bool begin(); bool fromJSON(JsonObject &obj); diff --git a/Somfy.cpp b/Somfy.cpp index 2de8dd7..bcc41d8 100644 --- a/Somfy.cpp +++ b/Somfy.cpp @@ -1710,7 +1710,7 @@ void RECEIVE_ATTR Transceiver::handleReceive() { // We need to ignore this bit. // REMOVE THIS AFTER WE DETERMINE THAT THE out-of-bounds stuff isn't a problem. If there are bits // from the previous frame then we will capture this data here. - if(somfy_rx.pulseCount < MAX_TIMINGS) somfy_rx.pulses[somfy_rx.pulseCount++] = duration; + if(somfy_rx.pulseCount < MAX_TIMINGS && somfy_rx.cpt_synchro_hw > 0) somfy_rx.pulses[somfy_rx.pulseCount++] = duration; return; } last_time = time; @@ -1740,24 +1740,18 @@ void RECEIVE_ATTR Transceiver::handleReceive() { else { // Reset and start looking for hardware sync again. somfy_rx.cpt_synchro_hw = 0; - //somfy_rx.pulseCount = 0; // Try to capture the wakeup pulse. if(duration > tempo_wakeup_min && duration < tempo_wakeup_max) { memset(&somfy_rx.payload, 0x00, sizeof(somfy_rx.payload)); - //somfy_rx.pulseCount = 1; - somfy_rx.cpt_synchro_hw = 0; somfy_rx.previous_bit = 0x00; somfy_rx.waiting_half_symbol = false; somfy_rx.cpt_bits = 0; somfy_rx.bit_length = 56; } - else if(duration > tempo_wakeup_silence_max) { + else if((somfy_rx.pulseCount > 10 && somfy_rx.cpt_synchro_hw == 0) || duration > 150000) { somfy_rx.pulseCount = 0; } - //else { - // somfy_rx.pulseCount = 0; - //} } break; case receiving_data: diff --git a/SomfyController.ino.esp32.bin b/SomfyController.ino.esp32.bin index 6229d6b..60b8e74 100644 Binary files a/SomfyController.ino.esp32.bin and b/SomfyController.ino.esp32.bin differ diff --git a/Web.cpp b/Web.cpp index e8a732f..7bcc714 100644 --- a/Web.cpp +++ b/Web.cpp @@ -905,10 +905,10 @@ void Web::begin() { server.send(500, _encoding_json, F("{\"status\":\"ERROR\",\"desc\":\"Shade not found to pair\"}")); } else { - if(shade->bitLength == 56) - shade->sendCommand(somfy_commands::Prog, 7); - else - shade->sendCommand(somfy_commands::Prog, 1); + //if(shade->bitLength == 56) + shade->sendCommand(somfy_commands::Prog, 4); + //else + // shade->sendCommand(somfy_commands::Prog, 1); shade->paired = true; shade->save(); DynamicJsonDocument doc(512); diff --git a/data/index.js b/data/index.js index 62e6203..da37f9d 100644 --- a/data/index.js +++ b/data/index.js @@ -880,7 +880,7 @@ class Wifi { document.getElementById('spanNetworkChannel').innerHTML = isNaN(strength.channel) || strength.channel < 0 ? '--' : strength.channel; let cssClass = 'waveStrength-' + ((isNaN(strength.strength) || strength > 0) ? -100 : this.calcWaveStrength(strength.strength)); let elWave = document.getElementById('divNetworkStrength').children[0]; - if (!elWave.classList.contains(cssClass)) { + if (typeof elWave !== 'undefined' && !elWave.classList.contains(cssClass)) { elWave.classList.remove('waveStrength-0', 'waveStrength-1', 'waveStrength-2', 'waveStrength-3', 'waveStrength-4'); elWave.classList.add(cssClass); }