Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
shortcuts
#1
hi rob,

I got another idea.
is it possible to have shortcuts on the homescreen?
for example if you press on the "sliding" parameters (PH, EC etc.) that you would go to the sensor display
and if you press on the light mode that you got to the light modes setting page, same goes for dosing.

you already did that for the power and feeding why not for everything on the homescreen?
that would leave some space for other buttons at the bottom of the screen.

hope its not to much work if you plan on realizing it.
I couldn't find it in the display sketch myself otherwise i would implement it myself K05106 K05106
Reply to top
#2
Hi Fietsenrex, I will do that. I'm working on a large update and will squeeze it in, details coming in a few days.
Reply to top
#3
Great thanks :D
Reply to top
#4
can't wait to see all the new updates and fixed stuff its always a good day when updates come out :)
Reply to top
#5
Yeah, and i can't wait to get the new/updated controller board. And finaly get everything setup and running in my aquarium :)
Reply to top
#6
rob,
since you're building a 2nd gen robo-tank, could you please point out to me where I can find the mapping of the touch in order to create my own shortcuts?
Reply to top
#7
Yeah for sure. Lets see.

First if you go to line 7754 in display sketch you'll see the following 3 lines.

Code:
myTouch.read();
x = myTouch.getX();
y = myTouch.getY();

Add these 4 lines after the above lines. With this done you can open the serial window on the Arduino IDE and get the coordinates of the screen when you touch. 
Code:
Serial.print("x = ");
Serial.println(x);
Serial.print("y = ");
Serial.println(y);


For the shortcuts on the home page, look for line 7761, just a few lines down from the above code.

You'll see "case 1:"

Everything under "case 1:" is the touch code for the home page. When you hit "case 2:" that's the next page which is feeding. Every page has a case number for the touch code.

Now go to line 1646, you'll see.

Code:
void screenHome()
{

this is the home screen.

Now scroll through the code and you'll come to 

Code:
void screenFeeding()
{

this is the feeding screen. If you put your cursor in front of the open bracket on line 2 from above you can scroll down and you'll see the closing bracket is kinda highlighted. This is good to find the end of the function.

At the end you'll see the beginning of a new page.

So anytime you want to load a new page you need to call the function name for the page you want to load.

For example we want to load the home page we would use the following code.

Code:
screenHome();

If we want to load the feeding page we use

Code:
screenFeeding();

The code to load the light settings page is

Code:
screenLights();

Once you find the names of the pages you want to load we need to add this to the touch section for the home page, this is "case 1:" on line 7761 as described above.

In this case section you add the code for the extra buttons. It's best to add it to the bottom of the section, if you find "case 2:" on line 7987 you have the end of the section.

The last line of each case section has

Code:
break;

followed by the new case number. You want to add the extra buttons just above the break.

For example the last button on the home page is the following.

Code:
else if ((x >= 650) && (x <= 799) && (y >= 54) && (y <= 359))
{
screenPower();
}

Every new button is the same code, copy and paste any button and change the page inside you want to call. You can see that button is loading the "Power Screen", if you changed that to screenLights(); you would get the lights settings page.

You also have to change the X and Y coordinates in the "else if" to the proper coordinates.

With the display plugged in your computer and the serial window in the Arduino IDE open you can get the coordinates by touching the top left corner and the bottom right corner of the button. Then replace the numbers and you should be good.

Well I hope that all makes sense, let me know.
Reply to top
#8
well it makes sense, I think I can work with it.
as soon as i get it working I'll let you know ;)
Reply to top
#9
Here's the code to add for the dosing pumps and light mode button. The PH area can't be used for a shortcut, right now when you touch that part it scrolls to the next parameter and a press and hold it will beep and reset min/max.

Find line 7982 and you should see this.
Code:
else if ((x >= 650) && (x <= 799) && (y >= 54) && (y <= 359))
{
screenPower();
}

under that add this.
Code:
else if ((x >= 213) && (x <= 436) && (y >= 54) && (y <= 153))
{
 screenLights();
}
else if ((x >= 437) && (x <= 650) && (y >= 154) && (y <= 359))
{
 screenDosing();
}        

then under what you added you should already have this.
Code:
break;
case 2:
Reply to top
#10
well that was easy :P
think I'll upload it tonight to see if it works properly thank you very much
Reply to top
#11
No problem, I think I got the right coordinates. I meant to add that to the long one but forgot. I wanted to explain how to do it if you want to make other changes.
Reply to top
#12
Bit late but remembered this morning that the shortcuts were "installed"
And tested them out and they work like a charm :)

Screen response is a bit lagging but that might be due to the water damage..
Reply to top
#13
Great. When you say display is lagging do you mean images load slow?

The SD card being used can greatly effect how fast the display runs. If you want to test the speed of the card you can add a couple lines of code and check in the Arduino IDE serial window how fast it loads an image. Then you can try a different card to see which runs fastest.

In the display sketch for v2.3 if you find line 889 you'll see.

Code:
myFiles.loadBitmap(0, 0, 800, 480, "robotank.raw");  

That's the splash image you see when you turn on the controller.

Replace that line with this.

Code:
 Serial.print("Load Image 1: ");
 Serial.println(millis());
 myFiles.loadBitmap(0, 0, 800, 480, "robotank.raw");
 Serial.print("Load Image 2: ");
 Serial.println(millis());

After you upload open the serial window, set the baud rate in the bottom right hand corner to 115200 and you'll see this. (This is from mine)

Load Image 1: 183
Load Image 2: 1283

Then subtract the first number from the second number and you get how many milliseconds it took to load.

1283 - 183 = 1100ms = 1.1 second
Reply to top
#14
nope, it responds slow to the touch.
on the shortcuts it takes a bit of time to start loading the screen, but with the normal buttons it starts almost instantly with loading.

SD card is an old 512MB card which is faster than a 4GB class 4 or 8GB class 10
shame that the faster cards are so big.. a 1GB class 10 would be awesome for this project..

wouldn't that be an option on the gen3 controller? just a super fast CF memory on the PCB with a usb connection or something?
Reply to top
#15
I didn't try it but wouldn't it be possible to use a microSD card with an adapter?

Reply to top
#16
Probably, but the only ones I have are 32gb..
Reply to top
#17
(12-11-2016, 05:34 AM)fietsenrex Wrote: nope, it responds slow to the touch.
on the shortcuts it takes a bit of time to start loading the screen, but with the normal buttons it starts almost instantly with loading.

SD card is an old 512MB card which is faster than a 4GB class 4 or 8GB class 10
shame that the faster cards are so big.. a 1GB class 10 would be awesome for this project..

wouldn't that be an option on the gen3 controller? just a super fast CF memory on the PCB with a usb connection or something?

hmm, that's strange, if the shortcuts load slow the regular buttons should start the same way as they use the same code, only difference is the screen coordinates. 

There's other things that effect how fast the pages load, I don't know if a 1gb class 10 card would speed it up any more.
Reply to top
#18
(12-11-2016, 07:30 AM)Arne Wrote: I didn't try it but wouldn't it be possible to use a microSD card with an adapter?

That's how I run it with a 4gb card in an adapter.
Reply to top


Forum Jump:

Current time: 03-29-2024, 03:40 AM