As already mentioned here I try to develop a kind of BLE based race track lap counter .
The base station is a MDBT42s with external antenna, big LIPO batteries, a LCD, a few buttons, a piezo buzzer and a RGB LED.
The transponders are just Puck.js devices advertising at the highest rate.
The Puck/transponder code is quite simple: flash a LED once in a while to show it's active, detect keypress > 2 s for switching on/off
The MDBT42s/tracker code has gotten quite complex:
scan for transponders in range
monitor RSSI values and detect out-of-range (timeouts)
count lap when RSSI reaches a certain threshold
display various status pages (Laps, RSSI, RX counter, Battery)
log laps to array in RAM
Basically everything works, but after running a certain time/detecting some dozen laps everything freezes and things become quite unstable:
keypresses are still handled (setWatch() handler causes a beep)
display update loop (setInterval() seems stuck, connecting to the console and just once calling the display handler function seems to cure the setInterval() loop again
connecting the terminal via BLE after this stuck situation lasts forever
process.memory().free still shows ~390 when this happens, so I don't thinks this is a memory issue.
I have uploaded the current code.
Maybe someone has some pointers or an idea what might go wrong here.
The code is capsulated into classes with either dynamic or static methods, maybe some of this was not a good idea?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
As already mentioned here I try to develop a kind of BLE based race track lap counter .
The base station is a MDBT42s with external antenna, big LIPO batteries, a LCD, a few buttons, a piezo buzzer and a RGB LED.
The transponders are just Puck.js devices advertising at the highest rate.
The Puck/transponder code is quite simple: flash a LED once in a while to show it's active, detect keypress > 2 s for switching on/off
The MDBT42s/tracker code has gotten quite complex:
Basically everything works, but after running a certain time/detecting some dozen laps everything freezes and things become quite unstable:
setWatch()
handler causes a beep)setInterval()
seems stuck, connecting to the console and just once calling the display handler function seems to cure thesetInterval()
loop againprocess.memory().free
still shows ~390 when this happens, so I don't thinks this is a memory issue.I have uploaded the current code.
Maybe someone has some pointers or an idea what might go wrong here.
The code is capsulated into classes with either dynamic or static methods, maybe some of this was not a good idea?
2 Attachments