| 280 | } |
| 281 | |
| 282 | function updateReadout() { |
| 283 | const x = state.scanPos * state.viewport.xMax; |
| 284 | let y = state.fn ? state.fn(x) : 0; |
| 285 | const safeV = Math.max(0, Math.min(VOLTAGE_LIMIT, isNaN(y) ? 0 : y)); |
| 286 | document.getElementById("valX").innerText = x.toFixed(2); |
| 287 | document.getElementById("valVolts").innerText = safeV.toFixed(2); |
| 288 | document.getElementById("valDuty").innerText = ( |
| 289 | (safeV / VOLTAGE_LIMIT) * |
| 290 | 100 |
| 291 | ).toFixed(1); |
| 292 | } |
| 293 | |
| 294 | // Populate GPIO select dropdown for graph control |
| 295 | function populateGraphGpioDropdown() { |