fix compute_schedule_filt: scoping bug and reserved word 'stop'

- 'let s' was declared inside if/else blocks (block-scoped),
  making it invisible to 'return s' outside — declare s before the blocks
- 'stop' is a reserved identifier in Espruino (Shelly JS engine),
  rename to t_start/t_stop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 17:51:40 +01:00
parent 0c175b4a8e
commit f98edbb8d6

13
pool.js
View File

@@ -72,17 +72,18 @@ function compute_filtration_time(t) {
// [ start1, stop1, start2, stop2, ... ] // [ start1, stop1, start2, stop2, ... ]
function compute_schedule_filt(d) { function compute_schedule_filt(d) {
let start = 17 - d/2; let t_start = 17 - d/2;
let stop = 17 + d/2; let t_stop = 17 + d/2;
while (stop >= 24) while (t_stop >= 24)
stop = stop - 24; t_stop = t_stop - 24;
let s;
if (d < 24) { if (d < 24) {
let s = [ start, stop ]; s = [ t_start, t_stop ];
} }
else { else {
let s = [ start ]; s = [ t_start ];
} }
return s; return s;