Correct early requests
This commit is contained in:
parent
f0ff69d8d1
commit
273fb764e8
@ -47,15 +47,21 @@ void owRcv( OneWireSlave::ReceiveEvent evt, byte cmd ){
|
||||
switch( evt ){
|
||||
case OneWireSlave::RE_Reset:
|
||||
state = DeviceState::WAIT4COMMAND;
|
||||
#ifdef DEBUG
|
||||
Serial.println(F("Reset"));
|
||||
#endif
|
||||
break;
|
||||
case OneWireSlave::RE_Error:
|
||||
state = DeviceState::WAIT4RESET;
|
||||
#ifdef DEBUG
|
||||
Serial.println(F("Error"));
|
||||
#endif
|
||||
break;
|
||||
case OneWireSlave::RE_Byte:
|
||||
switch( cmd ){
|
||||
case OW_Cmd::START_CONVERSION:
|
||||
// Do a new request only if enough time passed
|
||||
if( millis() < conversionStartTime || millis() > conversionStartTime + 2000 ){
|
||||
if( !millis() || millis() < conversionStartTime || millis() > conversionStartTime + 2000 ){
|
||||
state = DeviceState::CONVERTING;
|
||||
OWSlave.beginWriteBit(0, true); // send zeros as long as the conversion is not finished
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user