Yes, understood - it is a bit of a pain for sure with all the ifdefs there.
There's also the question of devices like Puck.js that end up duplicating the code to talk to accelerometers.
I'm open to suggestions, but the problem for me is I don't really have the time to completely refactor everything, and really the only thing that can happen for me if I do it is something breaks and someone complains - nobody notices if it works.
As you noted though, some of these things interact - either they're on the same I2C wires, have to run at different I2C speeds (Puck.js) or they need to be turned on an off via an IO expander (Bangle.js 1) - it feels quite hard to pull that functionality out in a way that will completely remove the ifdefs from jswrap_bangle.c
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.
Yes, understood - it is a bit of a pain for sure with all the ifdefs there.
There's also the question of devices like Puck.js that end up duplicating the code to talk to accelerometers.
I'm open to suggestions, but the problem for me is I don't really have the time to completely refactor everything, and really the only thing that can happen for me if I do it is something breaks and someone complains - nobody notices if it works.
As you noted though, some of these things interact - either they're on the same I2C wires, have to run at different I2C speeds (Puck.js) or they need to be turned on an off via an IO expander (Bangle.js 1) - it feels quite hard to pull that functionality out in a way that will completely remove the ifdefs from jswrap_bangle.c