cyberman54 / ESP32-Paxcounter

Wifi & BLE driven passenger flow metering with cheap ESP32 boards
https://cyberman54.github.io/ESP32-Paxcounter/
Other
1.7k stars 399 forks source link

Sendcycle runtime setting is not restored after power cycle #649

Closed ChrSchultz closed 3 years ago

ChrSchultz commented 3 years ago

My Paxcounters sendcycle is set to 120

{
  "blescantime": 8,
  "flags": {
   "adr": 1,
   "alarm": 0,
   "antenna": 0,
   "blescan": 0,
   "countermode": 0,
   "filter": 0,
   "screen": 1,
   "screensaver": 0
},
   "loradr": 5,
   "payloadmask": {
   "alarm": 1,
   "battery": 1,
"bme": 1,
"counter": 1,
"gps": 1,
"sensor1": 1,
"sensor2": 1,
"sensor3": 1
},
"rgblum": 30,
"rssilimit": 0,
"sendcycle": 120,
"txpower": 14,
"version": "2.0.12",
"wifichancycle": 50
}

but instead of sending every 240 seconds the device is sending data every 60 seconds... If I set sendcyle by rcom 0x0A, 0x78 to 120 all is working fine ( device sends every 240 sec) than I reboot device with hard reset (Reset-Button) and device sends every 60 sec. but sendcyle is 120.

cyberman54 commented 3 years ago

Default is 60 seconds, as set in paxcounter_orig.conf.

If you change the cycle by rcommand, this should be persistent, meaning after reset device keeps this setting.

Need to check, if i can reproduce your observation, and if yes, will try to spot the bug.

cyberman54 commented 3 years ago

I can confirm this issue, i could reproduce it. But could not spot the bug yet.

Currently, it seems it's at least not a fatal bug in the NVS saving routine, since a modified runtime setting for counter mode is succesful restored after power up.

Weird. /cc @spmrider

cyberman54 commented 3 years ago

I just pushed a fix, which probably solves this, to development branch (v2.0.16). Could you, please, retest with this version and report result here? If the fix is successful, i will merge it to master. Thanks.

/cc @spmrider

ChrSchultz commented 3 years ago

I can´'t find development v2.0.16 ... in your repository... in the actually version of branch development exists the same issue... grafik

cyberman54 commented 3 years ago

I finally spotted the bug, in main.cpp the sendcycle was always initalized with the default value, not with the runtime configuration value. This is now fixed in master and now it should work. Can you confirm, please?

cyberman54 commented 3 years ago

https://github.com/cyberman54/ESP32-Paxcounter/commit/114aff924675f09c717fadc8305eb578f3325de8

ChrSchultz commented 3 years ago

now It works fine, I close Issue thanks