-
But also I am still puzzled where is the code that assigns jswrap_banglejs_gps_character(char ch) function to Serial1 input forever?
interesting, it is the type specifier EV_SERIAL1
https://github.com/espruino/Espruino/blob/c09de7bc3a206760f16fd9482c2152dd73a9f605/libs/banglejs/jswrap_bangle.c#L3662
as per this
https://github.com/espruino/Espruino/blob/62a456e99abd49805599c03602cffa5afeaa1138/scripts/common.py#L63
so looks like returning always true from that method makes the character handled so it is not passed further.The way it is done is quite complicated, here the
jswOnCharEvent
method is generated from such EV_XXX JSON comments https://github.com/espruino/Espruino/blob/47d22f82e1c5b325f62bdccafb324553dcff7655/scripts/build_jswrapper.py#L689
and here it is called https://github.com/espruino/Espruino/blob/86eba79a209f32a885e08ad34f688d406b04a8be/src/jsdevices.c#L419
I agree.
But also I am still puzzled where is the code that assigns jswrap_banglejs_gps_character(char ch) function to Serial1 input forever? And why it cannot be unassigned by Serial1.removeAllListeners(); ?