Pack 1 (US5000) sous surveillance cellule : repli bat, essais code-barres, boot tolerant
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011uJ47NxgfpGnuuMr3f2n7Z
This commit is contained in:
@@ -397,8 +397,14 @@ async function main() {
|
||||
// exactement le piege ouvert quand le cable a change de pack le 05/09.
|
||||
const codes = new Map();
|
||||
for (const ad of adresses) {
|
||||
const info = await commande(l, `info ${ad}`, 8000);
|
||||
const bc = (info.match(/Barcode\s*:\s*(\S+)/) || [])[1];
|
||||
// Trois essais par adresse (26/09) : sur les US5000, `info 4` est revenu
|
||||
// une fois sans code-barres au demarrage — ligne pas encore videe. Un seul
|
||||
// rate ne doit pas faire perdre un cycle entier au service.
|
||||
let bc = null;
|
||||
for (let essai = 0; essai < 3 && !bc; essai++) {
|
||||
const info = await commande(l, `info ${ad}`, 8000);
|
||||
bc = (info.match(/Barcode\s*:\s*(\S+)/) || [])[1] || null;
|
||||
}
|
||||
if (!bc) {
|
||||
console.log(`Code-barres illisible pour l'adresse ${ad} : on n'enregistre pas a l'aveugle.`);
|
||||
console.log('Relancer la commande — la ligne aura eu le temps de se vider.');
|
||||
@@ -411,6 +417,7 @@ async function main() {
|
||||
console.log('L\'heure enregistree est l\'heure REELLE de cette machine, pas celle du module');
|
||||
console.log('(l\'horloge interne du module derive de plusieurs heures).');
|
||||
console.log('Ctrl-C pour arreter.\n');
|
||||
let sansSoh = false; // passe a vrai si le firmware ignore `soh` (US5000)
|
||||
// Garde anti-blocage : si la ligne serie se fige (adaptateur qui ne repond
|
||||
// plus, module eteint), les lectures reviennent VIDES sans jamais lever
|
||||
// d'erreur (lireJusqua resout au timeout au lieu de rejeter), et le CSV
|
||||
@@ -436,12 +443,25 @@ async function main() {
|
||||
try { puis = courantsParModule(await commande(l, 'pwr', 10000)); }
|
||||
catch { /* on garde les tensions */ }
|
||||
for (const ad of adresses) {
|
||||
const t = await commande(l, `soh ${ad}`, 10000);
|
||||
// `soh` : "<n0based> <mV> <SOHCount> <statut>"
|
||||
const c = [];
|
||||
for (const ligne of t.split('\n')) {
|
||||
const m = ligne.trim().match(/^(\d{1,2})\s+(\d{4})\s+(\d+)\s+(\w+)/);
|
||||
if (m) c.push({ n: +m[1] + 1, mV: +m[2] });
|
||||
if (!sansSoh) {
|
||||
const t = await commande(l, `soh ${ad}`, 10000);
|
||||
// `soh` : "<n0based> <mV> <SOHCount> <statut>"
|
||||
for (const ligne of t.split('\n')) {
|
||||
const m = ligne.trim().match(/^(\d{1,2})\s+(\d{4})\s+(\d+)\s+(\w+)/);
|
||||
if (m) c.push({ n: +m[1] + 1, mV: +m[2] });
|
||||
}
|
||||
// ⚠️ Le firmware des US5000 (B69.26, 26/09/2026) repond « Unknown
|
||||
// command 'soh' ». On bascule alors sur `bat`, pour toute la session.
|
||||
if (/Unknown command/i.test(t)) sansSoh = true;
|
||||
}
|
||||
if (sansSoh) {
|
||||
// `bat` : "<n0based> <mV> <mA> <temp> <etat> ..." (une ligne par cellule)
|
||||
const t = await commande(l, `bat ${ad}`, 10000);
|
||||
for (const ligne of t.split('\n')) {
|
||||
const m = ligne.trim().match(/^(\d{1,2})\s+(\d{4})\s+(-?\d+)\s+(-?\d+)\s+([A-Za-z]+)/);
|
||||
if (m) c.push({ n: +m[1] + 1, mV: +m[2] });
|
||||
}
|
||||
}
|
||||
if (c.length < 10) { console.log(`${horodate()} module ${ad} : illisible`); continue; }
|
||||
const v = c.map((x) => x.mV);
|
||||
|
||||
Reference in New Issue
Block a user