Skip to content

Commit 2b91561

Browse files
committed
Prevent ADC noise from counting as non-zero current
1 parent 073b54a commit 2b91561

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arduino/node_relaywbutton.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ void NodeRelayWithButton::check_current(unsigned long now)
126126

127127
if (m_current_samples == 1000) { // Approx. 1 second
128128
m_current = 5.0*sqrt(m_current_sum / m_current_samples);
129+
if (m_current < 0.005) // ADC noise, round down to 0 current
130+
m_current = 0.0;
129131
m_current_sum = 0;
130132
m_current_samples = 0;
131133
}

0 commit comments

Comments
 (0)