Thanks for the info Alumi.
Intermittent events like this suggest to me that it's magnet/reed sensor related, causing the electromagnet to fire twice in quick succession, resulting in spuratic speed readings and the error above.
A couple of things to try:
- With the rear wheel off the ground, try rotating the wheel's magnet back slowly past the reed switch by hand - ie don't use the pedals, just turn using the wheel. Give it a few rotations, even moving it back and forth past the switch. Watch the speed displayed on the kiox. You're looking for any sudden surges in speed
- Ideally, you would your phone to monitor the magnetic field coming from the electromagnet to be know when it's firing (in case the Bosch app/kiox doesn't display the invalid speed readings, instead just triggering the error)
- You mentioned you're using a different magnet at the wheel. You want a magnet of the least strength possible which will still trigger the reed switch, as this will help to minimise the chance of a double read.
- Maybe try adding some more distance between your magnet and the reed sensor
- Finally, try moving the reed sensor slightly. The magnet should pass down the middle (along its length) of the reed sensor. Also try spinning the reed sensor ~90deg along its axis so that a different face points towards the passing magnet.
The megabobra code does feature a line to try to ignore these double reads, ignoring any readings that have occured within 100ms of the last. However I think this could do with an improvement to alter this 100ms dynamically based on the speed you're presently travelling. For example, at one relovution per 100ms the bike would be travelling ~80kph (29" wheel). Importantly the double read can happen at any speed. If the motor's seeing a speed of 10kph, I don't think it matters if it then suddenly sees a reading of 30kph or a sudden reading of 60kph - both are unaccounted for without pedalling or time to accrue speed when rolling down a hill.
Using a dynamic time to debounce the sensor might mean when travelling at 10kph, ignore readings within 600ms, when travelling at 30kph, ignore readings within 250ms etc. This will offer tigher control of these double readings.
Anyway, try the physical tests above. If there's no improvement, let's try a code change.
Let me know how you go.