Fix charging bugs, remove disabling charging since its not supported in HW
This commit is contained in:
@@ -26,14 +26,13 @@ BLECharacteristic cfgGitHash (0x1239); // GitHash R 8 bytes (7-char ha
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Charge mode
|
||||
// Charge mode
|
||||
void applyChargeMode(ChargeMode mode) {
|
||||
switch (mode) {
|
||||
case CHARGE_OFF: pinMode(PIN_HICHG, INPUT_PULLUP); break;
|
||||
case CHARGE_SLOW: pinMode(PIN_HICHG, OUTPUT); digitalWrite(PIN_HICHG, HIGH); break;
|
||||
case CHARGE_FAST: pinMode(PIN_HICHG, OUTPUT); digitalWrite(PIN_HICHG, LOW); break;
|
||||
case CHARGE_SLOW: pinMode(PIN_HICHG, INPUT); break;
|
||||
case CHARGE_FAST: pinMode(PIN_HICHG, OUTPUT); digitalWrite(PIN_HICHG, LOW); break;
|
||||
}
|
||||
const char* n[] = {"OFF (~0mA)", "SLOW (50mA)", "FAST (100mA)"};
|
||||
const char* n[] = {"SLOW (50mA)", "FAST (100mA)"};
|
||||
Serial.print("[CHG] "); Serial.println(n[mode]);
|
||||
}
|
||||
|
||||
@@ -113,7 +112,7 @@ void onConfigBlobWrite(uint16_t h, BLECharacteristic* c, uint8_t* d, uint16_t l)
|
||||
cfg.accelStrength = b->accelStrength;
|
||||
if (b->curve <= 2) cfg.curve = (CurveType)b->curve;
|
||||
cfg.axisFlip = b->axisFlip;
|
||||
if (b->chargeMode <= 2) { cfg.chargeMode = (ChargeMode)b->chargeMode; applyChargeMode(cfg.chargeMode); }
|
||||
if (b->chargeMode <= 1) { cfg.chargeMode = (ChargeMode)b->chargeMode; applyChargeMode(cfg.chargeMode); }
|
||||
#ifdef FEATURE_TAP_DETECTION
|
||||
if (b->tapThreshold >= 1 && b->tapThreshold <= 31) {
|
||||
cfg.tapThreshold = b->tapThreshold;
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@
|
||||
|
||||
// Persistence
|
||||
#define CONFIG_FILENAME "/imu_mouse_cfg.bin"
|
||||
#define CONFIG_MAGIC 0xDEAD123DUL
|
||||
#define CONFIG_MAGIC 0xDEAD123EUL
|
||||
|
||||
// Physical button sentinel
|
||||
#define BTN_PIN_NONE 0xFF // Stored in btn*Pin when that button is disabled
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
// Enums
|
||||
enum CurveType : uint8_t { CURVE_LINEAR=0, CURVE_SQUARE=1, CURVE_SQRT=2 };
|
||||
enum ChargeMode : uint8_t { CHARGE_OFF=0, CHARGE_SLOW=1, CHARGE_FAST=2 };
|
||||
enum ChargeMode : uint8_t { CHARGE_SLOW=0, CHARGE_FAST=1 };
|
||||
enum ChargeStatus: uint8_t { CHGSTAT_DISCHARGING=0, CHGSTAT_CHARGING=1, CHGSTAT_FULL=2 };
|
||||
|
||||
// Tap action types
|
||||
|
||||
Reference in New Issue
Block a user