Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



sketch too big erro...
 
Share:
Notifications
Clear all

[Solved] sketch too big error attempting to verify/compile project

69 Posts
2 Users
0 Likes
20.8 K Views
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

@hans
Awesome! I am going to try this tomorrow. 
I will let you know what happens
THANKS


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2677
 

You're welcome! Can't wait to see the results! 👍 


   
ReplyQuote
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

I looked at one of the examples TimeGPS.ino and it looks like all that library does is subtract the offset (in this case -4 for Eastern Daylight Time)

I can easily do that in code without adding a library.  I am going to try that and see what happens.
Although, the GPS time is in 24hr format and not AM/PM


   
ReplyQuote
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

I think I fixed the time offset.  Here is the code snippet that I used.
While I was at it I added AM/PM

I still need to adjust the GPS time for 12 hr but I will do that in a bit

 

const int time_offset = -4; // Eastern Daylight Time (USA)

tft.print(gps.time.hour() + time_offset);

//added to print AM/PM for adjusted GPS time
if (gps.time.hour() < 12) {
tft.print(" AM");
}
else {
tft.print(" PM");
}

This post was modified 4 years ago by tvr4

   
ReplyQuote
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

Convert 24hr GPS UTC time to 12hr AM/PM

 

int hours = gps.time.hour() + time_offset;

Code goes in loop
-----------------------

if (gps.time.hour() < 0) {
hours = 24 + hours;
}
if (gps.time.hour() > 23) {
hours = 24 - hours;
}


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2677
 

Nice! Thanks for posting the code as well! 👍 

I don't think this will adjust for date as well then I assume (or does date not matter)?
(since 3 AM UTC -> 11 PM [23:00] previous day in your timezone)

But it would not surprise me if you do not need 100% correct date at those times in the day 😋 
(between 0:00 and 4:00 AM)


   
ReplyQuote
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

Forget that code.  It does not work right.  It displays negative numbers and strange stuff

I am going to keep looking for another solution


   
ReplyQuote
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

This looks promising
https://www.instructables.com/id/Adjusting-GPS-Date-and-Time-to-your-Time-Zone/

I created a simple sketch to display the GPS time on theST7735 display.  Lets see what happens

 
File is attached to this post

So far I was able to get it to display the GPS time adjusted to my time zone. I had to use a constant for this sine it would probably take a huge library to find time zone from GPS coordinates.

It also displays the time as 12 hour with AM or PM

 


   
ReplyQuote
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

Couple minor issues you may be able to help with

1) sketch displays the date and time when the "waiting for sats" is displayed
It should display "waiting for sats" and not continue until number of sats > 0

2) the display flickers between displaying the date & time
Is there any way to reduce the flickering?

Thanks.  Code is going so far so good


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2677
 

To reduce flickering, if I recall correctly, I'd call any TFT function only when really needed.
So do not write "waiting for sats" when it is already displayed, and do not change hours, minutes or seconds when they haven't changed.
So lets say seconds changed, but minutes and hours didn't; then only write the seconds. 

So your "//TESTING" section should probably become a separate function.
Additionally, I'd save the text elements in global variables, so each time you'd like to do a tft.print call, you can first check if the value has changed or not.
If it changed, then print, else move on to the next text.

You can use setTextColor( color, backgroundcolor ); for that (background = black) - this way "new" text will overwrite existing text with a black background effectively erasing the previous pixels at that cursor position.
You may have to do some experiments with that.

I'd also avoid calling "tft.fillScreen(ST7735_BLACK);" as it blanks the entire screen - which will look like flickering.

I hope that makes sense. 😊 

I also recall that most displays have a slow mode and a fast mode, but I didn't check your code for that - it's been quite a while that I have used a display.

As for the "waiting for sats" message; you'd have to put a loop in setup() to wait for initial signal.
Not sure about the exact gps commands (not sure if ss.available works this way) but probably something like this:

void setup()
{
Serial.begin(9600);
ss.begin(GPSBaud);

tft.initR(INITR_GREENTAB);
tft.fillScreen(ST7735_BLACK);
tft.setCursor(5, 58);
tft.setTextSize(1);
tft.setTextColor(ST7735_GREEN,ST7735_BLACK);

// tft.setCursor(5, 58);
tft.print(" Waiting for Sats");

Serial.print("Acquiring GPS signal ");

while (ss.available() == 0)
{
delay(100);
Serial.print(".");
}

Serial.println("\nAt least one satellite found ...");
}

 


   
ReplyQuote
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

@hans
This is great advice.  I am learning so much thanks to your help.
I will look at these new ideas today.

I have been testing this clock adjust since yesterday and it works well to convert the GPS UTC time to local time.
It uses a time offset constant. 

The sketch does not handle the date change.  The date changes upon the GPS signal.
In this case, since the GPS time is 4 hours ahead of local time, the date changes 4 hours early.

I don't know an easy way to handle this and really don't want to add a lot more to the code.  I will investigate this later

The general time adjustment concept will be used for a GPS data logger for my RC cars.  Since I won;t be running the RC cars late at midnight hours it will not be a big problem.


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2677
 

You're most welcome! 😊 

This is the same way for me: I learn something new every day. 

Considering you won't be racing your RC between midnight and 4 AM it probably won't be an issue. I agree.
So it is probably not even worth the effort to have it 100% perfect.
Unless you want to later on share it with folks in different time zones of course (incase it becomes a problem there). 😉 

 


   
ReplyQuote
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

Very true.  All someone would have to do is change the timezone offset constant and they will be good to go. Unless someone runs their RC between midnight and 4am


   
ReplyQuote
 tvr4
(@tvr4)
Estimable Member
Joined: 4 years ago
Posts: 122
Topic starter  

I have been tinkering with the code based on your advice.. So far moved the code to print the date & time into a separate function

The main loop is a lot easier to read.  I have a question on the original code compared to your sample

The original satellite reception loop looks like this:

while (ss.available() > 0)
  gps.encode(ss.read()):
if (gps.location.isUpdated())

GPS_Timezone_Adjust():
ClockDisplay():

You had suggested :

while (ss.available() == 0
{
    delay(100):
    Serial.print("."):
}

If I understand correctly the original code would do the following
(I am a little confused with the while statement)
while the number of available satellites is 0 stay in while and wait for satellite acquisition
when there are available satellites then check to see if the GPS location is updated
then it will continue GPS timezone adjust and clock display functions

Your example would do the following:
while number of available satellites is 0 (no acquisition) then delay 100ms and print "." to the serial monitor
when number of available satellites is not 0 (GPS  acquisition) then print "at least one satellite found" to serial monitor

Would this be a correct understanding?

If so then your example would provide an element of feedback to the user, if I chose to do so, while the module is waiting for GPS acquisition.  Where the original code would just sit and wait and the user has no feedback what is going on?


   
ReplyQuote
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2677
 

The while(condition) statement makes the code between accolades ( { and } ) repeat as long as the condition is true.
Unfortunately, in the original code the while and the if statements were written in shorthand (which I would avoid for the sake of readability).

So the original code is the same as (in your previous post - you'll see the code below is much easier to read):

while (ss.available() > 0)

gps.encode(ss.read()):
}

if (gps.location.isUpdated())
{
GPS_Timezone_Adjust(); // I assume you mean to type a ";" here instead of a ":"
}

ClockDisplay(); // I assume you mean to type a ";" here instead of a ":"

So in this case this means:

While gps is available (I assume "available" returns the number of found satellites), so when the number of sats is > 0, encode the data pulled from the GPS chip.
If the GPS location is updated, then Adjust Timezone.
After that just display the Clock (which will always be executed once one or more sats have been detected.

So in short: your interpretation sounds right (obviously the feedback through the serial monitor could also be replaced with visual feedback on the display, which would probably make more sense).

The code I suggested just stays put until indeed at least one sat has been detected.
It may need a little refinement, since the displayed time will not be updated with my suggestion.


   
ReplyQuote
Page 3 / 5
Share: