Open dbrgn opened 7 years ago
Hmm, I think the global variable is just there to prevent calling SYSTEM_MODE(AUTOMATIC);
and also SYSTEM_MODE(MANUAL);
from the same program. You could start by directly trying to call the set_system_mode
function from main. If that works then we can add a Rusty mechanism to prevent calling that function twice.
Thinking about this a bit more. Since this is C++ this global state may also be being used to call set_system_mode
before main runs. If that's the case then we can use something like .init_array
to do the same from Rust. Better to look at the disassembly to figure out when set_system_mode
is called.
Is there already a way to support system modes?
https://docs.particle.io/reference/firmware/photon/#system-modes
I tried to add bindings, but this is a bit above my knowledge level since it seems to set global state.