mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Puck.js: Fix regression in 2v15/2v16 that stopped Puck.js v1 using magnetometer
This commit is contained in:
parent
bb1a4b6e0b
commit
06ec67ced7
@ -10,6 +10,7 @@
|
||||
Bangle.js1: Bangle.setUI({back}) now responds to BTN3 if there were no other watches on buttons
|
||||
ESP32: Allow up to 16k vars (if enough memory), allow non-active scan, and remove 30s BLE scan limit
|
||||
Graphics: Ensure a scroll inside a cliprect can't go out of bounds (previously it was bounded to screen)
|
||||
Puck.js: Fix regression in 2v15/2v16 that stopped Puck.js v1 using magnetometer
|
||||
|
||||
2v16 : JIT functions now execute in their own function scope (allows arguments)
|
||||
Move older 'HY' boards to use `g` for the built-in graphics, not `LCD` (and change docs)
|
||||
|
||||
@ -1650,13 +1650,13 @@ void jswrap_puck_init() {
|
||||
jshDelayMicroseconds(2500); // 1.7ms from power on to ok
|
||||
// MAG3110 WHO_AM_I - for some reason we have to use this slightly odd SW I2C implementation for this
|
||||
unsigned char buf[2];
|
||||
puckVersion = PUCKJS_UNKNOWN;
|
||||
puckVersion = PUCKJS_1V0; // set version so we use the correct I2C address
|
||||
mag_rd(0x07, buf, 1); // MAG3110 WHO_AM_I
|
||||
//jsiConsolePrintf("MAG3110 %d\n", buf[0]);
|
||||
if (buf[0]!=0xC4 && buf[0]!=0x00) { // sometimes MAG3110 reports ID 0!
|
||||
// Not found, check for LIS3MDL - Puck.js v2
|
||||
nrf_delay_ms(1); // LIS3MDL takes longer to boot
|
||||
puckVersion = PUCKJS_2V0;
|
||||
puckVersion = PUCKJS_2V0; // set version so we use the correct I2C address
|
||||
mag_rd(0x0F, buf, 1); // LIS3MDL WHO_AM_I
|
||||
//jsiConsolePrintf("LIS3 %d\n", buf[0]);
|
||||
if (buf[0] == 0b00111101) {
|
||||
@ -1664,7 +1664,7 @@ void jswrap_puck_init() {
|
||||
puckVersion = PUCKJS_2V0;
|
||||
} else {
|
||||
// Is it 2v1?
|
||||
puckVersion = PUCKJS_2V1;
|
||||
puckVersion = PUCKJS_2V1; // set version so we use the correct I2C address
|
||||
mag_rd(0x39, buf, 1); // MMC5603NJ WHO_AM_I
|
||||
//jsiConsolePrintf("MMC5603NJ %d\n", buf[0]);
|
||||
if (buf[0] == 16) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user