Updated Main Screen

Related to the development libraries, released by Curt Binder
Post Reply
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Updated Main Screen

Post by binder »

I'm working on a new/updated main screen. Since there are somethings that people don't really use much (the graph) and some people have expansion modules, I figured an update is possibly needed (or at least an alternative).

Here's a rough outline / idea for an alternate main screen. It has the graph removed and is displaying 4 expansion relays (5 relays total). The numbers next to the 2-5 outlets indicate which expansion box it is. There is no number next to the main relay. A possibility would be to put a * next to it or just leave it alone.
Also, the number of relays that are displayed would change and display according to how many expansions you have set on your controller. So if you only had 1 expansion, it would only show 1 expansion.

Here's the image:
4 expansion relays
4 expansion relays
4_relays.JPG (20.77 KiB) Viewed 7921 times
And here's what 1 expansion relay would look like:
1 expansion relay
1 expansion relay
1_relays.JPG (28 KiB) Viewed 7921 times
Keep in mind, this is just a rough outline/idea. Just thought I'd share this with everybody.

curt
chrome
Posts: 27
Joined: Thu May 26, 2011 6:28 am

Re: Updated Main Screen

Post by chrome »

oh yay I like.

I'm on your bleeding edge code, so I'd love to grab this too.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Updated Main Screen

Post by binder »

I'm thinking that the relay boxes should probably be moved down the screen if there is only 1 or 2 relays....I dunno. I'm just not a huge fan of all that "wasted space" between the relays and the date/time.

Maybe the temps and everything else should be pushed down some and a something added to the top OR I figure out a way to put a larger Temp and PH on the first line that would push the rest of the stuff down....if you had up to 2 relays possibly (2 expansion and 1 main relay).

I'm just talking out loud on some ideas.

curt
jx4hansen
Posts: 7
Joined: Tue Apr 26, 2011 9:28 pm

Re: Updated Main Screen

Post by jx4hansen »

I know some people don't like the graph, but I do look at the graph for the PH history.

What does AP and DP mean on the display?
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Updated Main Screen

Post by binder »

jx4hansen wrote:What does AP and DP mean on the display?
AP - Actinic Percentage
DP - Daylight Percentage

Just the percentage for the LED PWM connected to either of those ports.

curt
chrome
Posts: 27
Joined: Thu May 26, 2011 6:28 am

Re: Updated Main Screen

Post by chrome »

I'm a minimalist, so the less crap on the screen the better for me.
Ace25
Posts: 20
Joined: Sat May 21, 2011 10:22 am
Location: Lompoc, California

Re: Updated Main Screen

Post by Ace25 »

Is this something we can do ourselves, customizing the screen? Or is it pretty difficult?

Myself, I would like the top row for pH/Temp1, then 2 power blocks (1 expansion, like in the second example picture above), a PWM reading for 8 PWM channels (just percentage #s), and at the bottom a small graph with lines for pH and temp over a 24 hour time span.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Updated Main Screen

Post by binder »

Ace25 wrote:Is this something we can do ourselves, customizing the screen? Or is it pretty difficult?
Well, that depends on what you consider "difficult". Customizing the screen requires making changes to the libraries. For the most part, the calls to display the main screen are in one location. There are a few other calls that are scattered in several other places (mostly the call to display the graph).

I am going to preface this like always with the: "It is not recommended to modify the libraries"
If you modify them, then any future releases of the libraries will break what you have changed and will have to be re-added. (This has happened to people in the past and it was a pain to get things fixed again).

With that being said, if you are curious to see what is involved with displaying the information on the screen, I'd recommend looking at the ReefAngel_NokiaLCD.cpp and .h files. These are the ones that I'm working with for the changes (specifically the .cpp file)

curt
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Updated Main Screen

Post by rimai »

Actually, all the pre-made library functions are public, so you can call them yourself.
For example:

Code: Select all

ReefAngel.LCD.DrawOutletBox(10,50,ReefAngel.Relay.RelayData);
Try the attached code.
This would draw the relay status for the main relay box at the position x=10 and y=50.
The screen is 132x132.
The only thing to keep in mind is that you cannot call ReefAngel.ShowInterface() at the same time and have to call ReefAngel.Refresh() instead.
The drawback of doing this is that you will loose all the menu driven stuff that Curt has developed.
So, Curt... Maybe if you move the check for joystick button press to inside Refresh(), you could enable one to customize their screen the way they want. Just a thought :idea:
Attachments
CustomScreen.pde
(666 Bytes) Downloaded 506 times
Roberto.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Updated Main Screen

Post by binder »

rimai wrote: So, Curt... Maybe if you move the check for joystick button press to inside Refresh(), you could enable one to customize their screen the way they want. Just a thought :idea:
That is a thought. In fact, I'm going to look into something like this then. There is a lot that is handled with ShowInterface. There should be a way to improve the main screen drawing/displaying for people. One problem is like you mentioned, checking for the Joystick button press AND like you mentioned, you would lose the menu driven interface too.

I've got an idea that might be able to allow people to customize their own display and still have the menu driven stuff. I have to do some testing though before I can report back.

curt
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Updated Main Screen

Post by binder »

I've got a simple and easy way to handle this Custom Screen displaying. In order for everything to work as planned (meaning you can still have the menu system but get to customize exactly how you want your main screen to look), you will have to do several things:
  • include a define statement (#define CUSTOM_MAIN) that tells the libraries that you will be providing your own display functions and to not use the built-in ones
  • define 2 functions in your PDE/Sketch file: DrawCustomMain and DrawCustomGraph. These functions will have to be created no matter what....even if you are not going to draw a graph. The libraries will depend on those functions being in your PDE file. If you do not create them, you will get compiler errors.
With this being said, you would then need to do something like this inside your PDE file:

Code: Select all

#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>

void DrawCustomMain()
{
  ReefAngel.LCD.DrawDate(6, 112);
  pingSerial();
  ReefAngel.LCD.DrawText(T1TempColor, DefaultBGColor, 15, 10, "T1:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp1, T1TempColor, 15+18, 10, 10);
  ReefAngel.LCD.DrawText(PHColor, DefaultBGColor, 15+60, 10, "PH:");
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, PHColor, 15+78, 10, 100);
  pingSerial();
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 23, TempRelay);
  ReefAngel.LCD.DrawOutletBox(12, 35, TempRelay);
}

void DrawCustomGraph()
{
  ReefAngel.LCD.DrawGraph(5,50);
}

void setup()
{
    ReefAngel.Init();  //Initialize controller
    // Ports that are always on
    ReefAngel.Relay.On(Port8);
    ReefAngel.Relay.On(Port1);
    ReefAngel.Relay.On(Port2);
}

void loop()
{
    ReefAngel.ShowInterface();

    // Specific functions
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker2(Port4);
}
So far it's working pretty good for me. For those of you who are interested in this, feel free to grab the latest code from github account and then use the PDE file I listed in the code above as a starting point (this is the same PDE file in my SketchBook repository called CustomMain).

curt
chrome
Posts: 27
Joined: Thu May 26, 2011 6:28 am

Re: Updated Main Screen

Post by chrome »

Ahh very nice, so far so good. Only 1 minor issue, which is more than likely a problem on my end...

I was using RAGen before to generate pde's.. using your master branch, and then I would add my custom functions back in to the pde. However with this new CustomMain branch, it's ignoring all my changes made in RAGen, and using it's own features.

Like for example, I remove ALL lighting, led's, wavemakers, and timeouts from the menu system and now they're showing again.

Also note, that I had to comment out the following 2 lines because I got compile errors if I didn't. Just a minor bug i'm sure.

//ReefAngel.OverheatShutoffPorts = B00000000;
//ReefAngel.LightsOnPorts = B00000000;

See my attached pde
Attachments
RA_053011_0001.pde
(2.04 KiB) Downloaded 472 times
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Updated Main Screen

Post by binder »

If you just copied the code into your main libraries folder, you shouldn't have a problem. I would make sure that RAGen is pointing to the proper libraries folder (Edit --> Settings) and also make sure that arduino is using the same folder as well.
I'm also not sure why you had to comment out those 2 lines. I just tested it here and it worked fine for me. I think something with the library location has the compiler confused. I would make sure that arduino points to the proper folder then restart arduino.

curt
chrome
Posts: 27
Joined: Thu May 26, 2011 6:28 am

Re: Updated Main Screen

Post by chrome »

Ok actually those 2 lines gave an error even with the older libraries. I've been commenting them out forever if I can remember correctly. However, I just compiled fine with the Overheat line uncommented so that's not an issue anymore.

Here is one of the errors:

RA_053011_1933.cpp: In function 'void setup()':
RA_053011_1933:71: error: 'class ReefAngelClass' has no member named 'LightsOnPorts'

Also, I just verified with RAGen again reverting back to a different library somehow.

I unzipped the CustomMain library's over what I already have there, overwriting all directories (like I've always done with your libraries), and then added your new Main Screen code from your PDE to my PDE. Uploaded to board and it worked perfect.

Opened RAGen like I normally do - verified settings and directories were correct, changed the features to what I want, setup everything under PDE tab, and clicked generate. Saved and opened arduino. Copied over the new main screen code over from a previous PDE, saved and uploaded to controller.

Once it uploaded, it was showing the default screen with graph at top, t1-t3 mid left, ph on right, main relay bar, and date time below that. It looked nothing like your screen.

The only way I can get it to look like your screen with the bars at the top is if I don't use RAGen - but then I got no wifi, and it has all the other default stuff I always turn off. :/
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Updated Main Screen

Post by binder »

Ok. I now know what it's doing, at least with the screen part. There is a define statement that RAGen does not know about. When RAGen runs, it creates a new Features file. So you have to manually edit the ReefAngel_Features.h file to re-enable the custom main screen. You will need to add this line to the Features file:

Code: Select all

#define CUSTOM_MAIN
Make all your changes like you said you did. Just before you upload to the controller, edit the Features file (like I just mentioned) and save it. Then upload to the controller and you should be good to go.

You will also want to remove that second DrawOutletBox line too. It just repeats the main relay on a second line just as a demo to show multiple relay boxes. So if you have multiple relays then we can fix that to display properly.

curt
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: Updated Main Screen

Post by alexwbush »

it'd be nice if you could toggle onto relays and change the status of the relax to either auto, on, or off right from the main screen. I think this would be extremely useful when doing maintenance, troubleshooting, or if something was going wrong and needed to be fixed quickly.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: Updated Main Screen

Post by alexwbush »

it'd also be nice if I could show timers (as in count down timers) like the ATO timer. That way I could use it to monitor how things were doing. I don't really use the graphs that much since I just pull up a web page on my computer or phone.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Updated Main Screen

Post by binder »

alexwbush wrote:it'd also be nice if I could show timers (as in count down timers) like the ATO timer. That way I could use it to monitor how things were doing.
That's easy to do now. If you use the CustomMain feature (as of 6/3/2011, it's in my main branch but not in the latest officially released code), you can create your custom main screen (like what is mentioned above).
To get the timer countdown, you could do something like this:
if you are using the standard ato

Code: Select all

ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 5, 10, "ATO:");
if ( ReefAngel.LowATO.IsTopping() )
  // we are topping, display the countdown
  ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 25, 10, millis()-ReefAngel.LowATO.Timer);
else
  ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 25, 10, "Not Active");
You may have to experiment with the positioning on the screen, but that would be something to do. Or you could even make it be where you only display the ATO stuff on there if it's active and hidden otherwise like this:

Code: Select all

if (ReefAngel.LowATO.IsTopping() )
{
  ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 5, 10, "ATO:");
  ReefAngel.LCD.DrawText(DefaultFGColor, DefaultBGColor, 25, 10, millis()-ReefAngel.LowATO.Timer);
}
Then if you were using the Single ATO stuff, you could use the same code for the low ato switch and then for the high ato switch just use HighATO instead of LowATO.

Just a thought on some ideas for you. With the custom main ability, you now should be able to have the main screen display just about anything you want.

curt
Post Reply