Răsfoiți Sursa

Merge remote-tracking branch 'origin/develop' into xap

QMK Bot 2 ani în urmă
părinte
comite
92bc32f1c9
1 a modificat fișierele cu 3 adăugiri și 0 ștergeri
  1. 3 0
      drivers/sensors/pmw3360.c

+ 3 - 0
drivers/sensors/pmw3360.c

@@ -15,6 +15,9 @@ uint16_t pmw33xx_get_cpi(uint8_t sensor) {
     }
 
     uint8_t cpival = pmw33xx_read(sensor, REG_Config1);
+    // In some cases (100, 900, 1700, 2500), reading the CPI corrupts the firmware and the sensor stops responding.
+    // To avoid this, we write the value back to the sensor, which seems to prevent the corruption.
+    pmw33xx_write(sensor, REG_Config1, cpival);
     return (uint16_t)((cpival + 1) & 0xFF) * PMW33XX_CPI_STEP;
 }