Template Builder

Community contributed apps
Post Reply
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Template Builder

Post by binder »

lnevo wrote:An easier builder I'd like to see is one for scheduling to build a template of if/thens so people could schedule lighting set points, night mode, different wave forms much easier and not have issues with all the conditionals, etc...
I'm starting this topic here to hash out some ideas and I didn't want to override the other topic about a visual graphics builder wizard.

My MenuGenerator (https://github.com/curtbinder/MenuGenerator), is capable of menus based on XML files that contain the actual code for the controller. I would think that this could be modified and adapted to conform to a new set of code and templates to help people out. Since the menu generator allows you to "pick" a predefined function and it inserts the code template and then allows you to tweak it some, one could alter the "predefined functions" to include the base templates for the functionality we want and then leave you with the skeleton to modify.

I've got some ideas in my head about this topic and was hoping to get some others input on this as well. Obviously this wouldn't account for all scenarios but if we could get a good base to start from, then that would be useful and helpful.

If anybody has some ideas or thoughts on some templates that could be created, that would be useful and helpful to provide a start.
I know Lee mentioned something like "do this in night mode" or "lighting modes" or "enter this wavemode when it's 5pm"...etc.
I think the hard part would be drawing the line at where to end... :)

Thoughts or ideas or examples people?
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Template Builder

Post by lnevo »

Scheduling in general.

How many people have made the mistake:

if ( (hour()<6) && (hour()>21) // do something..

But I think people that want to create complex lighting schedules etc.. would have a great use for creating set points when and where they want.

The only thing I would suggest is we use seconds or ScheduleTime (I think that was removed from the libs though) to conver hour,minute,second.

Just to make sure we don't end up with things like...

if ( (hour()>3 && minute()>30) && (hour()<19 && minute()<30)

The only non-time based things that would help from a scheduling perspective would be... for 30 minutes after water change mode.. these get complicated but I think could be rolled inside this if we come up with an easy structure to maintain.

Anyway, I've already relayed my ideas let's here what other people have :)
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Template Builder

Post by rimai »

The problem with creating set points is that there are no good java UI components that can do that. Or at least I couldn't find :(
I thought of creating something like that in the Wizard, but never found anything decent.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Template Builder

Post by lnevo »

Theres no time ui elements?
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Template Builder

Post by binder »

lnevo wrote:Theres no time ui elements?
you can use jspinners set with a date editor to limit it to time values. I just found it online. :-)

Sent from my Moto X
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Template Builder

Post by rimai »

Oh, I see... Simple time spinners....
That works :)
I was thinking more like a interactive chart where you can drag the setpoints around a 24hr axis.
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Template Builder

Post by binder »

rimai wrote:Oh, I see... Simple time spinners....
That works :)
I was thinking more like a interactive chart where you can drag the setpoints around a 24hr axis.
ooooohhh.... those 24 hr things are just on Android and probably ios. unless someone has created that widget or something like it on stackoverflow. :-)

Sent from my Moto X
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Template Builder

Post by binder »

rimai wrote:Oh, I see... Simple time spinners....
That works :)
I was thinking more like a interactive chart where you can drag the setpoints around a 24hr axis.
ooooohhh.... those 24 hr things are just on Android and probably ios. unless someone has created that widget or something like it on stackoverflow. :-)

Sent from my Moto X
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Template Builder

Post by lnevo »

That would be cool if we had a dot chart on an x y axis y click a + to add a new dot and drag it to the x (time) and y (%) you could build an if then structure inside a function that you could then call in your loop wherever you wanted that value used.

This way we dont have a million

ReefAngel.PWM.SetDaylight(75);

Instead the schedule would be self contained function and you can just do

ReefAngel.PWM.SetDaylight(pwmSchedule());

byte pwmSchedule() {
byte x

if ...
else if ...
else if...
return x
}
Post Reply