Parameter out of range warning flasher

Requests for new functions or software apps
User avatar
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis
PostPosted: Wed Sep 12, 2012 12:56 pm
I'm adding a little function on my display to flash the numbers red when they are above or below where I expect them to be so they are easy to see. I thought it might be useful if others want to use it as well and maybe we could add it to future libraries. There might be easier ways to do this as well. Here is my attempt....

Code: Select all
//function to flash warning (parameter, high limt, low limit, x, y, decimal)
void Warningflash(int param, int high, int low, byte x, byte y, byte z)
{
  int mod=second()%2;
  if (param > high || param < low)
 {
     if (mod==0) ReefAngel.LCD.Clear(DefaultBGColor,x,y,x+40,y+10);
     else ReefAngel.LCD.DrawSingleMonitor(param, COLOR_RED, x, y, z);
 }
 else ReefAngel.LCD.DrawSingleMonitor(param, DefaultFGColor, x, y, z);
}
...
void DrawCustomMain()
{
ReefAngel.LCD.DrawDate(6, 2);
ReefAngel.LCD.Clear(0, 1, 11, 132, 11);
  // Display the PH with color sensors
ReefAngel.LCD.DrawText(PHColor,DefaultBGColor, 5, 13,"PH:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, 0, 23, 13, 100);
Warningflash(ReefAngel.Params.PH, 840, 790, 23, 13, 100);
.....


I'll try this tonight to see how it goes.
-Jon
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Sep 12, 2012 1:26 pm
Awesome idea! Should definitely be in the libraries as a standard function..

DrawSingleMonitorFlash()
DrawSingleMonitorAlarm()

or even just override the existing DrawSingleMonitor();

Code: Select all
void DrawSingleMonitor(param, color, x, y, z, high, low, warning_color?); ?


I think I like the override personally, not sure if that will be more confusing to some...

Posts: 12188
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Sep 12, 2012 1:31 pm
Wanna try to create a pull request :)
Roberto.
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Sep 12, 2012 2:32 pm
rimai wrote:Wanna try to create a pull request :)


Sure. which method did you prefer though?

I do need to get back to the git stuff so I can clone off your dev branch and start the commenting process again...

I'm in montreal for the week for business so next week I can setup the function. Any feedback on the function declaration I put? I can rearrange the params, etc on feedback...

Lee

Posts: 12188
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Sep 12, 2012 2:39 pm
yes, fork the latest dev branch and work on it. When you are done, send a pull request.
I personally like DrawSingleMonitorAlarm() :)
Roberto.
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Sep 12, 2012 2:52 pm
Cool, I'm not partial, and long term that will be less confusing for people who may not understand overridden functions...
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Sep 26, 2012 11:12 am
Ok, I've cloned the repo again... merged with dev and added the DOxygen title page and the function DrawSingleMonitorAlarm function... here's the declaration

Code: Select all
void DrawSingleMonitorAlarm(int Temp, byte fcolor, byte x, byte y, byte decimal, byte high, byte low, byte wcolor);


So the params are the same as DrawSingleMonitor with the addition of high, low and warning color to the args.

Hopefully my pull request is good, but it seems two seperate commits happened, and the second was after the pull request, so I'm not 100% sure what I'm doing git wise...

Lee
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Fri May 03, 2013 2:03 pm
Ok, I think I finally made a clean pull request for this function :)

Posts: 12188
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri May 03, 2013 2:09 pm
Yeap :)
It will be in the next lib release.
Roberto.

Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC
PostPosted: Fri May 03, 2013 2:25 pm
haha- I was reading this thinking, "oh, I should +1 this"... then I looked at the dates :-)

This is great. I have a question re: the method prototype though.

Code: Select all
void DrawSingleMonitorAlarm(int Temp, byte fcolor, byte x, byte y, byte decimal, byte high, byte low, byte wcolor);


Isn't it a problem that "Temp" is an int and "high" and "low" are bytes?
Current setup:
60g 24" custom cube (fish and softies right now)
AI Sol Blue, Ecotech MP-10wES
Coralife skimmer
100% customer controller, transitioning to ReefAngel
Next

Return to Requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron