Skip to content

Commit

Permalink
[RN8209] Fix processlock usage (#1623)
Browse files Browse the repository at this point in the history
* [RN8209] Fix processlock usage

Update processlock usage to the while, instead of the higher level condition that is never checked after the task is launched
  • Loading branch information
1technophile authored Apr 28, 2023
1 parent 7961551 commit 587797a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions main/ZsensorRN8209.ino
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ float getRN8209current() {
}

void rn8209_loop(void* mode) {
if (!ProcessLock) {
uint32_t voltage;
int32_t current;
int32_t power;
uint32_t voltage;
int32_t current;
int32_t power;

while (1) {
while (1) {
if (!ProcessLock) {
uint8_t retv = rn8209c_read_voltage(&voltage);
uint8_t ret = rn8209c_read_emu_status();
uint8_t retc = 1;
Expand All @@ -82,10 +82,8 @@ void rn8209_loop(void* mode) {
if (retc == 0) data["current"] = (float)current / 10000.0;
if (retp == 0) data["power"] = (float)power / 10000.0;
if (data) pub(subjectRN8209toMQTT, data);
delay(TimeBetweenReadingRN8209);
}
} else {
Log.trace(F("RN8209 reading canceled by processLock" CR));
delay(TimeBetweenReadingRN8209);
}
}

Expand Down

0 comments on commit 587797a

Please sign in to comment.