esp32-timed-switch/scheduler.h
2024-01-27 19:15:53 +01:00

95 lines
1.4 KiB
C

#define A00 0b000000000000
#define A60 0b111111111111
#define HALF_HOUR 0b000000111111
#define EVERY_2 0b010101010101
#define EVERY_2_INV 0b101010101010
#define HOUR_DEFAULT 16
#define MINUTE_DEFAULT 41
#define EVENT_INC_MINUTE 5
// our scheduler loop every 24 hour.
// one hour is represented by 1 unsigned int
// each bit of the hour represent one BI_MINUTE.
// the output of the scheduler is ON if one bit is set, OFF otherwise.
unsigned int scheduler_1_default[24] = {
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
};
unsigned int scheduler_default_deactivate[24] = {
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
A00,
};
unsigned int scheduler_2_default[24] = {
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
EVERY_2,
EVERY_2_INV,
};