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:
13
pool.js
13
pool.js
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user