Parameter out of range warning flasher

Requests for new functions or software apps
Post Reply
User avatar
jsclownfish
Posts: 378
Joined: Mon Oct 24, 2011 7:52 pm
Location: Saint Louis

Parameter out of range warning flasher

Post by jsclownfish »

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
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Parameter out of range warning flasher

Post by lnevo »

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...
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Parameter out of range warning flasher

Post by rimai »

Wanna try to create a pull request :)
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Parameter out of range warning flasher

Post by lnevo »

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
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Parameter out of range warning flasher

Post by rimai »

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
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Parameter out of range warning flasher

Post by lnevo »

Cool, I'm not partial, and long term that will be less confusing for people who may not understand overridden functions...
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Parameter out of range warning flasher

Post by lnevo »

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
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Parameter out of range warning flasher

Post by lnevo »

Ok, I think I finally made a clean pull request for this function :)
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Parameter out of range warning flasher

Post by rimai »

Yeap :)
It will be in the next lib release.
Roberto.
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Parameter out of range warning flasher

Post by enigma32 »

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
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Parameter out of range warning flasher

Post by lnevo »

Yes.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Parameter out of range warning flasher

Post by lnevo »

Pushed the fix :)
enigma32
Posts: 74
Joined: Fri Apr 26, 2013 11:48 am
Location: Los Angeles and NYC

Re: Parameter out of range warning flasher

Post by enigma32 »

haha excellent
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
Post Reply