Refactor MPPT CAN reader with options and logging

This commit is contained in:
Giuseppe Raffa
2026-06-06 14:11:45 +02:00
parent c893fa3edf
commit 2cc320b484
4 changed files with 199 additions and 38 deletions

View File

@@ -23,9 +23,9 @@ const status1Flags = {
1: 'ChgEna', // Ponte Pin1-Pin8 inserito (enable hardware)
2: 'ChgOk', // Condizioni di ricarica OK
3: 'PwrOn', // Stadio di potenza acceso (eroga corrente)
4: 'StorMod', // Modalita' storage attiva
5: 'FloatMod', // Modalita' float (mantenimento)
6: 'CtrlEna', // Algoritmo MPPT abilitato
4: 'CtrlEna', // Algoritmo MPPT abilitato
5: 'StorMod', // Modalita' storage attiva
6: 'FloatMod', // Modalita' float (mantenimento)
7: 'CCapRst', // Reset contatore Ah
8: 'Ph1Ena', // Fase 1 abilitata
9: 'Ph2Ena', // Fase 2 abilitata
@@ -61,14 +61,14 @@ const registerAddresses = {
deviceAddress: 1, // Addr - indirizzo del dispositivo (confermato: usato per discovery)
status1: 4, // St1 - flag di stato (confermato: "registro 4")
warning: 6, // Warn - flag di warning/errore (confermato: "registro 6")
chargeCapacity: 7, // Chg_Cap - Ah caricati (da verificare)
voltageInput: 16, // Vi - tensione ingresso (da verificare)
currentInput: 17, // Ii - corrente ingresso (da verificare)
voltageOutput: 18, // Vo - tensione uscita (da verificare)
currentOutput: 19, // Io - corrente uscita (da verificare)
voltageInput: 16, // Vi - tensione ingresso (manuale: registro 16)
currentInput: 18, // Ii - corrente ingresso (manuale: registro 18)
voltageOutput: 22, // Vo - tensione uscita (manuale: registro 22)
currentOutput: 27, // Io - corrente uscita (manuale: registro 27)
powerInput: 20, // Pi - potenza ingresso (confermato)
powerOutput: 21, // Po - potenza uscita (confermato)
temperature1: 35, // T1 - temperatura fase 1 (confermato)
powerOutput: 31, // Po - potenza uscita (manuale: registro 31)
chargeCapacity: null, // Chg_Cap - nel PDF hw1.2r01 collide con T1 sul registro 35: non pollare finche' non confermato
temperature1: 35, // T1 - temperatura fase 1 (manuale: registro 35)
temperature2: 36, // T2 - temperatura fase 2 (confermato)
};
@@ -84,7 +84,6 @@ const pollRegisters = [
registerAddresses.currentInput,
registerAddresses.voltageOutput,
registerAddresses.currentOutput,
registerAddresses.chargeCapacity,
registerAddresses.temperature1,
registerAddresses.temperature2,
];