mirror of https://github.com/arendst/Tasmota.git
fix determination of the current weekday. (#17812)
the result of c logical expressions is 0 or 1, not the values of the operands.
This commit is contained in:
parent
78fe958d89
commit
9e522e8fa3
|
@ -862,6 +862,11 @@ tuyamcubr_recv_time(struct tuyamcubr_softc *sc, uint8_t v,
|
|||
const uint8_t *data, size_t datalen)
|
||||
{
|
||||
struct tuyamcubr_time tm;
|
||||
uint8_t weekday;
|
||||
|
||||
weekday = RtcTime.day_of_week - 1;
|
||||
if (weekday == 0)
|
||||
weekday = 7;
|
||||
|
||||
/* check datalen? should be 0 */
|
||||
|
||||
|
@ -872,7 +877,7 @@ tuyamcubr_recv_time(struct tuyamcubr_softc *sc, uint8_t v,
|
|||
tm.hour = RtcTime.hour;
|
||||
tm.minute = RtcTime.minute;
|
||||
tm.second = RtcTime.second;
|
||||
tm.weekday = (RtcTime.day_of_week - 1) || 7;
|
||||
tm.weekday = weekday;
|
||||
|
||||
tuyamcubr_send(sc, TUYAMCUBR_CMD_TIME, &tm, sizeof(tm));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue