feat(firmware-v2): 48V build envs for 13s packs
The v2 PlatformIO firmware is the one in production — complete the 48V voltage-class support started in config.h: - config.h: imbalance tolerance 2 V in 48V class (x13/7 of the 1 V @7s fleet policy). - BatteryParallelator.h / INAHandler.h: member defaults now come from the config.h class macros instead of hardcoded 24000/30000 (they are overwritten by setters at setup(), defensive only). - platformio.ini: new kxkm-s3-16MB-48v and kxkm-v3-16MB-48v envs extending the production envs with -DBATTERY_PACK_CLASS_48V. Validated: pio run green for kxkm-s3-16MB-48v and kxkm-s3-16MB (default 24V unchanged), sim-host tests 13/13 pass.
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#ifndef BATTERY_PARALLELATOR_H
|
||||
#define BATTERY_PARALLELATOR_H
|
||||
|
||||
#include "config.h"
|
||||
#include "INAHandler.h"
|
||||
#include "TCAHandler.h"
|
||||
#include <KxLogger.h>
|
||||
@@ -80,8 +81,8 @@ private:
|
||||
bool lockState(TickType_t timeout = pdMS_TO_TICKS(20));
|
||||
SemaphoreHandle_t stateMutex = NULL;
|
||||
float battery_voltages[16];
|
||||
int mem_set_max_voltage = 30000;
|
||||
int mem_set_min_voltage = 24000;
|
||||
int mem_set_max_voltage = alert_bat_max_voltage; // défauts = classe de tension (config.h),
|
||||
int mem_set_min_voltage = alert_bat_min_voltage; // écrasés par les setters au setup()
|
||||
int mem_set_max_current = 1000;
|
||||
int mem_set_voltage_diff = 2000;
|
||||
int mem_set_current_diff = 1000;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define INA_HANDLER_H
|
||||
|
||||
#include <KxLogger.h>
|
||||
#include "config.h"
|
||||
#include <INA226.h>
|
||||
#include <Wire.h>
|
||||
|
||||
@@ -61,8 +62,8 @@ private:
|
||||
volatile uint8_t readings[17]; ///< Compat: nombre de mesures
|
||||
byte INA_address_connected[16]; // Adresses INA connectées
|
||||
uint8_t Nb_INA; // Nombre d'INA connectés
|
||||
int max_voltage = 30000; // Seuil de surtension de la batterie en mV (overvoltage)
|
||||
int min_voltage = 24000; // Seuil de sous-tension de la batterie en mV (undervoltage)
|
||||
int max_voltage = alert_bat_max_voltage; // Seuil de surtension en mV (défaut = classe de tension, config.h)
|
||||
int min_voltage = alert_bat_min_voltage; // Seuil de sous-tension en mV (défaut = classe de tension, config.h)
|
||||
int max_current = 1000; // Seuil de surintensité de la batterie en mA
|
||||
int max_charge_current = 1000; // Seuil de courant de charge de la batterie en mA
|
||||
int i2cSpeedKHz = 100; // Vitesse I2C en KHz
|
||||
|
||||
@@ -29,7 +29,11 @@
|
||||
#define current_diff 10 // Réservé (non utilisé en V1)
|
||||
|
||||
// ── Déséquilibre tension ─────────────────────────────────────────────────────
|
||||
#ifdef BATTERY_PACK_CLASS_48V
|
||||
#define voltage_diff 2 // Tolérance déséquilibre (V) — ×13/7 vs 1 V @7s
|
||||
#else
|
||||
#define voltage_diff 1 // Tolérance déséquilibre entre batteries (V)
|
||||
#endif
|
||||
|
||||
// ── Reconnexion / verrouillage ───────────────────────────────────────────────
|
||||
#define reconnect_delay 10000 // Délai de reconnexion en ms (nb_switch == max)
|
||||
|
||||
@@ -84,6 +84,20 @@ lib_deps =
|
||||
lib_extra_dirs =
|
||||
${arduino_base.lib_extra_dirs}
|
||||
|
||||
; --- Variante 48V (packs 13s Li-ion, hardware BMU-v2-48v) ---
|
||||
; Seuils : 44600/55200 mV, déséquilibre 2 V — cf. firmware/src/config.h
|
||||
[env:kxkm-s3-16MB-48v]
|
||||
extends = env:kxkm-s3-16MB
|
||||
build_flags =
|
||||
${env:kxkm-s3-16MB.build_flags}
|
||||
-DBATTERY_PACK_CLASS_48V
|
||||
|
||||
[env:kxkm-v3-16MB-48v]
|
||||
extends = env:kxkm-v3-16MB
|
||||
build_flags =
|
||||
${env:kxkm-v3-16MB.build_flags}
|
||||
-DBATTERY_PACK_CLASS_48V
|
||||
|
||||
[env:native]
|
||||
platform = native
|
||||
build_flags =
|
||||
|
||||
Reference in New Issue
Block a user