 // Length of first MaxM light cycle in seconds
 // The light scripts on the MaxMs MUST be
 // shorter than this value.
-// const byte maxm1_cycle = 90;
-const byte maxm1_cycle = 30;
+const byte maxm1_cycle = 90;
+// const byte maxm1_cycle = 30;
 
 // Seconds after starting first MaxM to start second
-// const byte maxm2_offset = 30;
-const byte maxm2_offset = 15;
+const byte maxm2_offset = 30;
+// const byte maxm2_offset = 15;
 
 // Length of time check cycle in seconds
-// const byte check_cycle = 60;
-const byte check_cycle = 15;
+const byte check_cycle = 60;
+// const byte check_cycle = 15;
 
 // LEDs
 const byte led1 = 1;

            // maxm2.write(0);
            // maxm2.stop();

            doFlash(ledPort, led1, 2);
#ifdef DEBUG_TRACE
            Serial.println("MAXM2");
            Serial.flush();
#endif
            break;

        // Check if within operational time
        case OPER_TIME:
            // Get time
            DateTime now = RTC.now();

            // Check every check_cycle seconds
            int sec_til_check = check_cycle - (now.get() % check_cycle);
            scheduler.timer(OPER_TIME, sec_til_check * 10);

#ifdef DEBUG_TRACE
            Serial.print("RTC time: ");

DeviceI2C maxm1 (MaxMbus, maxm1Dev);
DeviceI2C maxm2 (MaxMbus, maxm2Dev);

// LEDs on port 4
Port ledPort (4);

// 1 = lights working, 0 = lights not
byte is_operational = 0;

// Set to 1 when the MaxMs are awake (active)
byte maxms_awake = 0;

// Wake periods. There are some serious constraints on this list
// which are not checked but violations will cause unintended
// results!
// 1. The entries must be in ascending order by day and 
//    start time.
// 2. The sleep time of one period must be earlier than the
//    wake time of the next period.
// 3. This implies that the periods cannot overlap.
Wakeperiod wps[] = {
    {1, hm2min(19, 59), hm2min(20, 18)},
    {1, hm2min(21, 31), hm2min(21, 32)},
    {1, hm2min(21, 34), hm2min(21, 36)},
    {1, hm2min(21, 39), hm2min(21, 42)},
    {1, hm2min(22, 17), hm2min(22, 20)},
    {1, hm2min(22, 22), hm2min(22, 24)},
    {2, hm2min(6, 40), hm2min(6, 58)},
    {2, hm2min(7, 40), hm2min(8, 3)},
    {2, hm2min(11, 40), hm2min(19, 59)},
};
byte num_wps = sizeof(wps) / sizeof(wps[0]);

// Add more tasks for second bench
enum { MAXM1, MAXM2, CHK_TIME, TASK_LIMIT };

static word schedBuf[TASK_LIMIT];
Scheduler scheduler (schedBuf, TASK_LIMIT);
