[RN8209] Fix publishing repeat (#1631)
This commit is contained in:
1 parent
25991bfbb4
commit
b03e18260f
1 file changed
+2
-2
@@ -46,7 +46,7 @@ void rn8209_loop(void* mode) {
|
|||||||
uint8_t ret = rn8209c_read_emu_status();
|
uint8_t ret = rn8209c_read_emu_status();
|
||||||
uint8_t retc = 1;
|
uint8_t retc = 1;
|
||||||
uint8_t retp = 1;
|
uint8_t retp = 1;
|
||||||
float previousPower = 0;
|
static float previousPower = 0;
|
||||||
if (ret) {
|
if (ret) {
|
||||||
uint32_t temp_current = 0;
|
uint32_t temp_current = 0;
|
||||||
uint32_t temp_power = 0;
|
uint32_t temp_power = 0;
|
||||||
@@ -82,7 +82,7 @@ void rn8209_loop(void* mode) {
|
|||||||
!PublishingTimerRN8209 ||
|
!PublishingTimerRN8209 ||
|
||||||
(abs(power - previousPower) > previousPower * PreviousPowerThreshold) && abs(power - previousPower) > MinPowerThreshold) &&
|
(abs(power - previousPower) > previousPower * PreviousPowerThreshold) && abs(power - previousPower) > MinPowerThreshold) &&
|
||||||
!ProcessLock) {
|
!ProcessLock) {
|
||||||
PublishingTimerRN8209 = millis();
|
PublishingTimerRN8209 = now;
|
||||||
previousPower = power;
|
previousPower = power;
|
||||||
if (data) pub(subjectRN8209toMQTT, data);
|
if (data) pub(subjectRN8209toMQTT, data);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user