Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Random date changes
#51

(31-10-2018, 19:46)engolling Wrote:  Hi Werk,

do you really think that the reason for the misbehavior is, that the RTC is set wrong in association with the new version of AVR board?

Yes, the RTC was being set wrongly. I will try to explain what I think about it below.

(31-10-2018, 19:46)engolling Wrote:  My assumption is, that somewhere is a hidden memory overflow somewhere in the sketch and the compiler optimizes differently when writing different code or having some changed code for the board functions.
Another point might be that I did not understand the problem  Blush

Usually a memory overflow problem will cause random error, and/or a software crash, in this case only a function was affected.

(31-10-2018, 19:46)engolling Wrote:  Because in compiling with boards manager AVR Board 1.6.22 only the unixtime() function was faulty but the day(), month() and year() function were working properly. So I'm not convinced that this is the main reason. Moreover all functions were working fine with the example sketch provided by RTClib.

I think the culprit of this problem was myself and not the boards manager version. I was using a wrong method to adjust the RTC, which perhaps was work before, due to the forgiveness of the Arduino IDE compiler.

Adjusting the RTC clock using RTC.adjust(local), being the local variable a time_t variable is wrong. If you look at the RTClib, the function is expecting a DateTime object not a time_t var.

A DateTime is a full class with lots of methods to it, where time_t is just an unsigned long, used to store the number of seconds since the epoch (normally 01/01/1970)
The Arduino Time library returns a time_t to the now() function, but RTCLib (RTC.now() ) returns a DateTime object (and expect it at RTC.adjust(DateTime) .
I think this explains the problem.

The example sketch provided by RTClib works with both boards manager versions because it is well written. The argument passed to the rtc.adjust function is a DateTime object, not a time_t variable as I stupidly did.

Code:
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

More and more the Arduino IDE is becoming less permissive regarding coding errors, which is good! It isn't the first time that an IDE upgrade broke the code, and surely it will not be the last. After all, this can be seen as an opportunity to learn a little more.

If you have found or will find any other cause for the issue that we are talking about, just tell me, I'm always open to be corrected and to correct things too.
One more time I would like to thank you for the help given during the last night, without it, most probably I still was fighting to find a solution.

Reply
#52

Hi,
I also noticed some date changes but only on my two 4Pro Wireless Display !! ( V4.1_b004 and older)

Laurent
Reply
#53

Hi Werk,

thanks for the explanation. I think I understood in principle, but could not get in on the source code…. C++ is too high for me  Blush Rolleyes.

Your always welcome and sometimes bug hunting is some kind of fun especially if you are not the one who worte the code  Wink 

Best wishes,
engolling
Reply
#54

(01-11-2018, 10:11)laulau Wrote:  Hi,
I also noticed some date changes but only on my two 4Pro Wireless Display !! ( V4.1_b004 and older)

Wondering why it wasn't fully reported... Huh

The Wifi Wireless Display units don't have an hardware RTC, and they aren't directly affect by the issue we are talking about. However if you noticed a Date change in your Wifi Wireless Display, that means the problem is on the receiver unit, which is broadcasting the Date and Time to it.

Anyway, upgrade both to latest software versions.

Reply
#55

(01-11-2018, 10:27)engolling Wrote:  ...

Your always welcome and sometimes bug hunting is some kind of fun especially if you are not the one who worte the code  Wink 

Thank you.
I thing that debugging code written by others is very difficult, however most of the times its the most effective way because often we do not see our own mistakes.
The Date & Time issue seems to be solved, anyway if you notice any problem please report back immediately.

Regards

Reply
#56

(02-11-2018, 00:42)Werk_AG Wrote:  
(01-11-2018, 10:11)laulau Wrote:  Hi,
I also noticed some date changes but only on my two 4Pro Wireless Display !! ( V4.1_b004 and older)

Wondering why it wasn't fully reported...  Huh

The Wifi Wireless Display units don't have an hardware RTC, and they aren't directly affect by the issue we are talking about. However if you noticed a Date change in your Wifi Wireless Display, that means the problem is on the receiver unit, which is broadcasting the Date and Time to it.

Anyway, upgrade both to latest software versions.

Sorry but it was a TIME change that occurs(1 hour back occasionally) Blush 

I think it was a problem with my TimeChangeRule configuration!
Seems to be sorted since i corrected it.
So nothing to do with RTC !! Angel

Laurent
Reply
#57

yesterday, I had a date error, she indicated
92/12/2018!. I take advantage of the new version v8 to update.
I am now stuck on 01/08/2018 after some restart.
I use a weatherduino pro2+ v1.30.

The log:
Quote:ESP8266 FW Version: AT+GMR

AT version:0.60.0.0(Jan 29 2016 15:10:17)
SDK version:1.5.2(7eee54f4)
Ai-Thinker Technology Co. Ltd.
May  5 2016 17:30:30
OK

Mode station OK
Multiple mux OK
Join AP success!
Connected to AP: AT+CWJAP?

+CWJAP:"MyPlace","00:18:84:xx:xx:xx",2,-35

OK

IP Address: 192.168.10.10
Broadcast IP: 192.168.10.255
RTC current date: % 39 2018
RTC current time: 17:30:39
Sending NTP request to sync clock...
NTP replied
UTC time from NTP server: 15:30:39

Local date set to: 17:30:39 79 2018
Local time set to: 17:30:39

RTC adjusted to local time: 17:30:39
RTC current date: 17:30:39 39 2018
RTC current time: 17:30:39

WiFi connection is ON
Connected to: 192.168.10.10


if you have an idea... i change the RTC with an other one and i have the same problem.

[Image: p_201814.jpg]
Reply
#58

Did you compile with the correct version of Arduino board, as advised by werk.
Quote:IMPORTANT:
Always compile using the provided libraries.
Tested with Arduino IDE 1.8.4 using AVR Boards Manager 1.6.20.
It not work reliably with AVR Boards Manager 1.6.22 and 1.6.23 usually installed by default with Arduino IDE >= 1.8.6

You can check this in the first entry of the menu, where you are selection your board.
Best regards, engolling
Reply
#59

I got myself last week with the programming of an arduino due that showed errors. I read that it was necessary to put an older version and it worked.
I did not think to look at what version is installed, but since it is the last version that I installed ...
Thank you, I test tomorrow.
Reply
#60

Hi,

Please keep in mind that isn't the Arduino IDE version that matters, it's the installed AVR board version that is important.
With any version of Arduino IDE, you can downgrade the AVR boards to 1.6.20 or 1.6.21. With versions 1.6.22 or 1.6.23 the random date issue will happen.

   
Reply




Users browsing this thread: 1 Guest(s)