K7MDL2 / IC-705-BLE-Serial-Example

Demonstrates how to connect to the IC-705 using Bluetooth Low Energy (BLE) and BT Classic Serial Port Profile for CI-V control and USB Host for a wider range of CI-V radios
3 stars 0 forks source link

BLE: Get occasional bad values for radio frequency and PTT status #17

Closed K7MDL2 closed 2 months ago

K7MDL2 commented 2 months ago

Investigate reason for occasional wrong values that appear for frequency and PTT state. Might need improved data validation, could be in the data itself, TBD. Did not notice this in BLE sample code, pre-integration.

The bad frequency that pops up always seems to be "7700105". Happens on any band.

PTT values that appear are 0, 1, or 131. PTT is actually a bool. The CI-V message for TX state is 0x1C,0,data where data is 1 byte long and either a 0 or 1 value. So 131 is not possible, nor are the 1's since the radio was in RX the whole time.

K7MDL2 commented 2 months ago

Cause was not in the CI-V data, but something in the final data conversion. Added validation with some other changes and problem is either hidden or gone away.

At the same observed some stack smashing resets happening close in time to processing mode/filter (0x26) messages. Removed 'String' with upper case S operations anywhere it is used repeatedly, mostly in LCD text draws like band, VFO, grid, etc. Seems better.