diff --git a/soft/thermostat/src/mainwindow.cpp b/soft/thermostat/src/mainwindow.cpp index 30ca7d7..4fd1942 100644 --- a/soft/thermostat/src/mainwindow.cpp +++ b/soft/thermostat/src/mainwindow.cpp @@ -130,10 +130,15 @@ double MainWindow::get_target_temperature(int room_idx) goto out; } + /* + * dayOfWeek() returns 1 for monday, 7 for sunday. + * so dow <<= 1 gives 0 for monday, 6 for sunday. + * And (1 << dow) gives the day of week as a bit field + */ dow <<= 1; for (int i = 0; i < r->progs.count(); i++) { p = &(r->progs.at(i)); - if (dow & p->DoW) { + if ((1 << dow) & p->DoW) { if (p->start_time == p->end_time) { continue; }