Puck.js: Fix regression where IR LED was left on after transmission (fix #1969)

This commit is contained in:
Gordon Williams 2021-01-04 13:48:09 +00:00
parent 7474b56525
commit d2ed4518a1
2 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,7 @@
Bangle.js: StorageFile now uses 10x bigger chunks which reduces stress on Storage.list()
Storage.list now allows you to specifically request StorageFile, only ever reports first StorageFile chunk
Graphics: Allow colors to be specified as '#rgb' strings
Puck.js: Fix regression where IR LED was left on after transmission (fix #1969)
2v08 : nRF52: Added option to build in I2C slave support
Fix Tensorflow aiGesture regression from 2v07 (re-add opcodes) (fix #1936)

View File

@ -934,7 +934,12 @@ void _jswrap_puck_IR_on() {
jshPinAnalogOutput(_jswrap_puck_IR_pin, 0.1, 38000, 0);
}
void _jswrap_puck_IR_off() {
jshPinOutput(_jswrap_puck_IR_pin, 1);
// normally we're doing single-pin IR with the cathode, so 1=off
bool polarity = 1;
// On Puck.js v2 we go through an (N)FET, which means 0=off.
if (isPuckV2 && (_jswrap_puck_IR_pin==IR_FET_PIN || _jswrap_puck_IR_pin==FET_PIN))
polarity = 0;
jshPinOutput(_jswrap_puck_IR_pin, polarity);
}
// Called when we're done with the IR transmission
void _jswrap_puck_IR_done(JsSysTime t, void *data) {