beepnl / beep-react-native-app

React native app for Android and iOS
1 stars 0 forks source link

"Error: command code 138" when connecting to base directly from the list screen (0.0.16) #1

Closed ezja closed 2 years ago

ezja commented 2 years ago

"Error: command code 138" signal-2022-08-19-162041_002

maartenvandillen commented 2 years ago

Command 138 is WRITE_HX711_CONVERSION. This screen tries to read all sensors once the device is connected. The device is returning error code 8. Not sure why. Maybe this can be found in the firmware source.

ezja commented 2 years ago

The firmware returns an "Invalid state" message when doing a read/write conversion while the DS18b20 statemachine is not in idle state:

https://github.com/beepnl/beep-base-firmware/blob/a7dd6a9df604c93a8ed7d4368784965f6556968d/Source_V1.5.12/Code/nRF/PRJ/App/DS18B20_app.c#L711

Reading the sensor value takes 750ms:

https://github.com/beepnl/beep-base-firmware/blob/a7dd6a9df604c93a8ed7d4368784965f6556968d/Source_V1.5.12/Code/nRF/PRJ/App/DS18B20_app.c#L598

Suggestion: call READ_DS18B20_STATE before doing a WRITE_DS18B20_CONVERSION and wait for >750ms if it has not yet returned to an idle state.

maartenvandillen commented 2 years ago

Thanks this helps. Found the cause of the issue.