Merge branch 'x3-support'

# Conflicts:
#	lib/GfxRenderer/GfxRenderer.h
#	open-x4-sdk
This commit is contained in:
jpirnay
2026-04-04 10:05:14 +02:00
16 changed files with 564 additions and 132 deletions
+8
View File
@@ -1,8 +1,10 @@
#pragma once
#include <Arduino.h>
#include <BatteryMonitor.h>
#include <InputManager.h>
#include <Logging.h>
#include <Wire.h>
#include <freertos/semphr.h>
#include <cassert>
@@ -16,6 +18,11 @@ class HalPowerManager {
int normalFreq = 0; // MHz
bool isLowPower = false;
// I2C fuel gauge configuration for X3 battery monitoring
bool _batteryUseI2C = false; // True if using I2C fuel gauge (X3), false for ADC (X4)
mutable int _batteryCachedPercent = 0; // Last read battery percentage (0-100)
mutable unsigned long _batteryLastPollMs = 0; // Timestamp of last battery read in milliseconds
enum LockMode { None, NormalSpeed };
LockMode currentLockMode = None;
SemaphoreHandle_t modeMutex = nullptr; // Protect access to currentLockMode
@@ -23,6 +30,7 @@ class HalPowerManager {
public:
static constexpr int LOW_POWER_FREQ = 10; // MHz
static constexpr unsigned long IDLE_POWER_SAVING_MS = 3000; // ms
static constexpr unsigned long BATTERY_POLL_MS = 1500; // ms
void begin();