Skip to content

Commit

Permalink
Change QPC detection from 4 to 7 power interrupts
Browse files Browse the repository at this point in the history
Change Quick Power Cycle detection from 4 to 7 power interrupts (#4066)
  • Loading branch information
arendst committed May 16, 2020
1 parent a9cd30f commit c119525
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c

### Version 8.3.0.1

- Change KNX pow function to approximative pow saving 5k of code space
- Change Mutichannel Gas sensor pow function to approximative pow saving 5k of code space
- Change Quick Power Cycle detection from 4 to 7 power interrupts (#4066)
- Fix default state of ``SetOption73 0`` for button decoupling and send multi-press and hold MQTT messages
3 changes: 3 additions & 0 deletions tasmota/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### 8.3.0.1 20200514

- Change KNX pow function to approximative pow saving 5k of code space
- Change Mutichannel Gas sensor pow function to approximative pow saving 5k of code space
- Change Quick Power Cycle detection from 4 to 7 power interrupts (#4066)
- Fix default state of ``SetOption73 0`` for button decoupling and send multi-press and hold MQTT messages

## Released
Expand Down
10 changes: 5 additions & 5 deletions tasmota/settings.ino
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ void UpdateQuickPowerCycle(bool update)
#else // ESP32
QPCRead(&pc_register, sizeof(pc_register));
#endif // ESP8266 - ESP32
if (update && ((pc_register & 0xFFFFFFF0) == 0xFFA55AB0)) {
uint32_t counter = ((pc_register & 0xF) << 1) & 0xF;
if (0 == counter) { // 4 power cycles in a row
if (update && ((pc_register & 0xFFFFFF80) == 0xFFA55A80)) {
uint32_t counter = ((pc_register & 0x7F) << 1) & 0x7F;
if (0 == counter) { // 7 power cycles in a row
SettingsErase(3); // Quickly reset all settings including QuickPowerCycle flag
EspRestart(); // And restart
} else {
Expand All @@ -372,8 +372,8 @@ void UpdateQuickPowerCycle(bool update)
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("QPC: Flag %02X"), counter);
}
}
else if (pc_register != 0xFFA55ABF) {
pc_register = 0xFFA55ABF;
else if (pc_register != 0xFFA55AFF) {
pc_register = 0xFFA55AFF;
#ifdef ESP8266
// Assume flash is default all ones and setting a bit to zero does not need an erase
if (ESP.flashEraseSector(pc_location)) {
Expand Down

0 comments on commit c119525

Please sign in to comment.