Comments (12)
Tried to format the code lines, but that would not work for me :-(
from ds3231m.
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.
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.
Cold it be some locale stuff?
from ds3231m.
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.
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.
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.
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.
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.
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.
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.
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)
- Doc example error ? HOT 1
- The SETDATE typed input fails due to the inputBuffer being shared (on Arduino Uno) HOT 2
- the bug of HOUR writing&reading HOT 4
- no way to tell whether the clock is set. HOT 1
- Reformat source code to clang-format HOT 1
- DS3231 vs DS3231M HOT 7
- Make directory structure adhere to Arduino 1.5.x and later structure HOT 1
- Link to Maxim on wiki pages is broken HOT 1
- dayOfTheWeek() has incorrect range HOT 2
- Calculate leap year HOT 3
- How to stop an defined alarm HOT 10
- STM32 cant upload again HOT 2
- Add support for 400KHz bus speed HOT 1
- Fix overflow on I2C speed definitions HOT 1
- Implement Travis-CI
- Update "SetAlarms.ino" to Doxygen-style comments and formatting HOT 1
- Change "Set.ino" to doxygen style comments and formatting HOT 1
- Change library source files to Doxygen-style comments and formatting HOT 1
- logic on pinAlarm and pinSquareWave are inverted HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ds3231m.