File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -34,20 +34,20 @@ bool OneWireSensorHub::begin() {
3434 MESH_DEBUG_PRINTLN (" OneWire: Scanning for sensor probes (%d ms)..." , ONEWIRE_DISCOVERY_TIMEOUT_MS);
3535
3636 unsigned long start = millis ();
37+ unsigned long last_rx = 0 ;
38+
3739 while ((millis () - start) < ONEWIRE_DISCOVERY_TIMEOUT_MS) {
3840 while (oneWireSerial.available ()) {
3941 if (_rxlen < sizeof (_rxbuf)) {
4042 _rxbuf[_rxlen++] = oneWireSerial.read ();
4143 }
42- delay ( 5 );
44+ last_rx = millis ( );
4345 }
4446
45- if (_rxlen > 0 ) {
47+ if (_rxlen > 0 && ( millis () - last_rx) >= 10 ) {
4648 RakSNHub_Protocl_API.process (_rxbuf, _rxlen);
4749 _rxlen = 0 ;
4850 }
49-
50- delay (100 );
5151 }
5252
5353 MESH_DEBUG_PRINTLN (" OneWire: Discovery complete. Found %d sensor probe(s)" , _found_pid_count);
@@ -57,7 +57,7 @@ bool OneWireSensorHub::begin() {
5757 return false ;
5858 }
5959
60- _next_poll_ms = millis () + 2000 ;
60+ _next_poll_ms = millis () + 10000 ; // First request within ~10 seconds only returned 0.0 values.
6161 _current_poll_idx = 0 ;
6262
6363 return true ;
You can’t perform that action at this time.
0 commit comments