simulate mode idea

Request new hardware or ideas for the controller

Posts: 263
Joined: Wed Jan 01, 2014 7:26 am
PostPosted: Sun Apr 27, 2014 5:24 am
Seems like an interesting idea would be to add a define statement for the .ino file that can make it run hours as minutes and dump all changes in state to Serial.println as it goes through the simulation. Having looked through the code it might be a ton of print statements and ifdef statements, though.
User avatar
Posts: 5361
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sun Apr 27, 2014 5:39 am
What would happen to code that is in seconds already? Any specific function your trying to test?

Posts: 263
Joined: Wed Jan 01, 2014 7:26 am
PostPosted: Sun Apr 27, 2014 7:17 am
Mostly lights and powerheads throughout the day, but dosers and water change and stuff like that could be neat too.

Maybe could do the ifdef that changes all calls to millis() to micros() and watch it all happen at 1000x faster. 8)
User avatar
Posts: 5361
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sun Apr 27, 2014 7:20 am
The problem with that is that it scales badly. loop() takes a number of miliseconds to run, so while you can usually be assured that your loop is called at least once per second the same cannot be said for millis and certainly not macros.

I would maybe say for a particular function you could add a scale variable that you could define along with the serial.println based on your ifdef but not globally.

Posts: 12288
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sun Apr 27, 2014 8:08 am
Here is my suggestion.
Implement a disable method to the RTC sync and then you can move in time freely.
We have a RTC sync set to every 6 hours, which means that RA will sync itself with the RTC time every 6 hours. So, if you stray 6 hours from the last time it synced, RA would communicate with the RTC and put you back in the correct time.
This is the line:
Code: Select all
setSyncInterval(SECS_PER_HOUR*6);  // Changed to sync every 6 hours.

It's locate in the file Arduino\libraries\ReefAngel\Plus\init.h
If you simply comment that line for now, you can move in time at will and RA would never sync its clock.
One way to do that is to add a global variable to hold the sync time period and a function to change this variable.
Then, you can use this function from the time library:
Code: Select all
void    adjustTime(long adjustment);

So, every loop or every x numbers of millis you can call it with an increment 1 by setting adjustment to 1, which would add 1 second to RA time or -1, which would decrease one second to RA time.
Roberto.

Posts: 263
Joined: Wed Jan 01, 2014 7:26 am
PostPosted: Sun Apr 27, 2014 8:52 am
Hey, neat idea. So every time through the loop you advance however much you want to get a "fast" mode without editing much code at all.

Return to Requests

Who is online

Users browsing this forum: No registered users and 1 guest