Git Product home page Git Product logo

Comments (12)

jegjessing avatar jegjessing commented on June 11, 2024

Tried to format the code lines, but that would not work for me :-(

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 11, 2024

Hello!

I vaguely remember having seen that problem before, but can't recall the details. Are you using the most recent library version and which Arduino are you using to reproduce the problem? If you use the adjust function to set an explicit time, e.g. "DS3231M.adjust(DateTime(2017,8,5,18,19,20));" does that work?

from ds3231m.

jegjessing avatar jegjessing commented on June 11, 2024

Hi, happy to hear that it's been seen before :-)

I'm using the most resent library yes.
It is both the Uno and the Mega ones.

Using the example you gave above the time was set to:
11:10:42.488 -> Time: 18:19:20

So, I would say yes. Works when set manually

from ds3231m.

jegjessing avatar jegjessing commented on June 11, 2024

Cold it be some locale stuff?

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 11, 2024

I seem to recall it had to do with the way that the compiler stores the date/time in the program and thought it might only have happened on the ESPlora processors. I will search through my cupboard for a functioning DS3231M and test it; but that might take a couple of days... (that's the downside of "free" support :) - nothing happens fast)

from ds3231m.

jegjessing avatar jegjessing commented on June 11, 2024

Actually I changed it to: DS3231M.adjust(DateTime(DATE, TIME)); and that works fine..

So I'm kinda ok now. But maybe the .adjust() should be modified to work with the above?

And no rush :-) U'm just happy someone reacted. Buying products is definitely not a guarantee for as good support as on open source projects.

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 11, 2024

Sorry for the long delay, I was overseas and didn't have a DS3231M to test with. I'm back now and haven't located a DS3231M to play with yet, but I think the problem lies on the compiler side. Are you compiling on a Windows or a Linux machine?

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 11, 2024

What is display if you use VERSION, DATE, and TIME pre-processor macros? Those are the officially supported ones for the compile, in my installation "DATE", "TIME" and "VERSION" aren't declared as macros.

from ds3231m.

lagg070988 avatar lagg070988 commented on June 11, 2024

I have reproduced the code and I get the same error in ubuntu 20.04 arduino 1.8.16 library 1.0.8 arduino nano, I have added some serial.print (for fun and in the spirit of learning) and discovered the following:
I have seen that: DS3231M.adjust (); becomes adjust (DateTime (F (__ DATE__), F (__ TIME__))); line 323
then DateTime::DateTime(const __FlashStringHelper* date, const __FlashStringHelper* time); line 146
then in line 160, (calling a constructor within another constructor): DateTime(ybuff, tbuff)
and here is when the DateTime object is generated. So far everything is fine, the object retains the date and time as it should be, but when going back out of DateTime::DateTime(const __FlashStringHelper* date, const __FlashStringHelper* time); the object disappears and contains no data.
and void DS3231M_Class::adjust(const DateTime& dt); line 325 receive nothing (or random values )
doing DateTime agua = DateTime (F(__DATE__), F(__TIME__)); Serial.println(agua.year()); get nothing consistent.
I'm too new to c ++ and I still don't understand what happens with the disappearing object, it seems to me that when calling a constructor inside another, it creates an object that is only available inside it, and cannot be used outside. but I'm not sure, I'm just learning. hope this can help.

from ds3231m.

lagg070988 avatar lagg070988 commented on June 11, 2024

solve by adding this on line 160
DateTime a = DateTime( ybuff, tbuff); // Use the string version to instantiate
yOff = a.yOff, m = a.m, d = a.d, hh = a.hh, mm = a.mm, ss = a.ss;
But something curious happens: the saved value of __date__ and __time__ from the library is updated every time I make a change in the library, or every time I restart the Arduino IDE.
If in a session I upload the sketch 3 times, they will all have the same value for __date__ and __time__
it must be an arduino IDE matter

from ds3231m.

SV-Zanshin avatar SV-Zanshin commented on June 11, 2024

I can't reproduce this with the Windows compiler and IDE. The date and time are compiled into the library when it is built. It could be that your IDE settings rebuild the library automatically when the IDE is opened, which would explain the behavior.

I think this problem is really down to compiler settings and differences on various platforms.

from ds3231m.

lagg070988 avatar lagg070988 commented on June 11, 2024

I have reproduced the code and I get the same error in:

  • ubuntu 20.04 arduino 1.8.16 library 1.0.8 arduino nano (my pc)
  • Windows 10 arduino 1.8.19 library 1.0.8 arduino nano (my son's pc)
  • Arduino online editor (https://create.arduino.cc/editor)

works as it should when adding this on line 160 (DS3231M.cpp):

DateTime a = DateTime( ybuff, tbuff); // Use the string version to instantiate
yOff = a.yOff, m = a.m, d = a.d, hh = a.hh, mm = a.mm, ss = a.ss;

I can't reproduce this with the Windows compiler and IDE. The date and time are compiled into the library when it is built. It could be that your IDE settings rebuild the library automatically when the IDE is opened, which would explain the behavior.

this is curious, I have tried in 3 different ways and I get the same result

from ds3231m.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.