NPM 0xFF = capteur deconnecte sur page sensors et self-test
Quand npm_status = 0xFF (aucune reponse du capteur), affiche "Capteur deconnecte" au lieu de lister tous les flags d'erreur. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -155,36 +155,51 @@
|
||||
// NPM status decoded
|
||||
if (response.npm_status !== undefined) {
|
||||
const status = response.npm_status;
|
||||
const statusText = status === 0 ? "OK" : response.npm_status_hex;
|
||||
const statusColor = status === 0 ? "green" : "orange";
|
||||
$("#data-table-body_" + port).append(`
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td style="color: ${statusColor}; font-weight: bold;">${statusText}</td>
|
||||
</tr>
|
||||
`);
|
||||
|
||||
// Decode individual error bits
|
||||
const statusFlags = {
|
||||
0x01: "Sleep mode",
|
||||
0x02: "Degraded mode",
|
||||
0x04: "Not ready",
|
||||
0x08: "Heater error",
|
||||
0x10: "THP sensor error",
|
||||
0x20: "Fan error",
|
||||
0x40: "Memory error",
|
||||
0x80: "Laser error"
|
||||
};
|
||||
Object.entries(statusFlags).forEach(([mask, label]) => {
|
||||
if (status & mask) {
|
||||
$("#data-table-body_" + port).append(`
|
||||
<tr class="error-row">
|
||||
<td></td>
|
||||
<td style="color: red;">⚠ ${label}</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
});
|
||||
if (status === 0xFF) {
|
||||
// 0xFF = no response from sensor = disconnected
|
||||
$("#data-table-body_" + port).append(`
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td style="color: red; font-weight: bold;">Capteur déconnecté</td>
|
||||
</tr>
|
||||
`);
|
||||
} else if (status === 0) {
|
||||
$("#data-table-body_" + port).append(`
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td style="color: green; font-weight: bold;">OK</td>
|
||||
</tr>
|
||||
`);
|
||||
} else {
|
||||
$("#data-table-body_" + port).append(`
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td style="color: orange; font-weight: bold;">${response.npm_status_hex}</td>
|
||||
</tr>
|
||||
`);
|
||||
// Decode individual error bits
|
||||
const statusFlags = {
|
||||
0x01: "Sleep mode",
|
||||
0x02: "Degraded mode",
|
||||
0x04: "Not ready",
|
||||
0x08: "Heater error",
|
||||
0x10: "THP sensor error",
|
||||
0x20: "Fan error",
|
||||
0x40: "Memory error",
|
||||
0x80: "Laser error"
|
||||
};
|
||||
Object.entries(statusFlags).forEach(([mask, label]) => {
|
||||
if (status & mask) {
|
||||
$("#data-table-body_" + port).append(`
|
||||
<tr class="error-row">
|
||||
<td></td>
|
||||
<td style="color: red;">⚠ ${label}</td>
|
||||
</tr>
|
||||
`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
|
||||
Reference in New Issue
Block a user