d0ughb0y
Active member
let me see if I have this figured out...above is the part of the code that has to be altered to set the on/off times...so say I want my outlet to come on at 7am and off at 9pm, I would change the code to read like below
there's 25200 second from midnight til 7am, that's the initial off time, then on for 14 hours which equals 50400 seconds, then off the remaining seconds from 86400, which is the 24 hour cycle in seconds...did I figure that correctly ?
in the comment above the #define line you quoted is the instructions
//define the default outlet program here. outlets must appear in exact order defined in outlet names definition
//program outletname, initial off time, on time, off time, days active, mode
#define OUTLETSDEFAULT {{OUTLET1,0,SECS_PER_DAY,0,0xff,_auto},\
1. outlet name
2. initial off time in seconds
3. on time in seconds
4. off time in seconds
5. active days bit mapped into one byte
6. mode
cycle time is 2+3+4 and should multiple into 24.
the entry for 7am on 9pm off everyday is
OUTLET1, 25200, 50400, 10800, 0xff,_auto
The time for items 2,3 and 4 are interval times, meaning, 7 hours OFF, 14 hours ON, 3 hours OFF for a total of 24 hours total cycle time.
The SECS_PER_DAY is just a #define whose value is the number of seconds in a day, and the example is for an outlet that is ON 24 hours a day (hence OFF times are 0).