Yes, but I'm still stuck on this strategy requiring the availability of the internet. I'd still love to see a way for sucking the time from a smart phone; they're omnipresent now 🙂
Anything seems possible when you don't know what you're talking about.
@will Agreed. My problem is I think I know it can be done securely from the net, but your way also sounds like it should be doable. I just have no idea where to start with that because I have 0 experience.
The first challenge in this entire 'get a new time' exercise is what is the inout method? How to enter a command etc. All we have AFAIK is the reset button which invokes the startup code.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
The first challenge in this entire 'get a new time' exercise is what is the inout method? How to enter a command etc. All we have AFAIK is the reset button which invokes the startup code.
Wasn't he just going to press a button on his pass generator device to reload the time ?
Anything seems possible when you don't know what you're talking about.
@will Yes, that was his original design, but he also had no security and the other users would have to modify the source code and upload it. NOT at all optimal.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@will The issue is once the friend presses a button or the reset button how does his app connect to a nearby AP without having some way to enter the AP's creds? I thought that both WiFiMgr and @Inq's portal did something like that but like I said I know just enough to be dangerous.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@will Me too 😀
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@will Agreed. My problem is I think I know it can be done securely from the net, but your way also sounds like it should be doable. I just have no idea where to start with that because I have 0 experience.
The first challenge in this entire 'get a new time' exercise is what is the inout method? How to enter a command etc. All we have AFAIK is the reset button which invokes the startup code.
this is me in a nutshell. 🙂
I gave up around dinner time and watched sport instead last night, but an update;
i can get the wifi manager stuff working to an extent, but because of my limitations and gaps in knowledge i am unable to make it all work together with the original program.
I am going to mess around with a board with just a few buttons connected to see how i go with the wifi manager stuff today triggering the reset but also triggering the printing(but i will just use the serial monitor for now).
In my mind, from what you have all pointed out and helped me understand, it will work like this(hopefully);
The device has a button i can press that runs the wifi manager. This leads to the settings being erased and new ssid and pass being enterable, this would be the users phone hotspot details. once entered, the device reboots with the new details, grabs the time from an ntp service, sets the rtc, then disconnects, never to be used again until that button is pressed.
this feels like it should be the easiest solution, but i may be wrong.
also in this context, easy is a relative term, i am still at a loss how to bring all these things together in one happy, united sketch.
again, thanks to everyone for their input. i will try and post some progress later on.
@ajpatrick The WiFi manager stuff should go in the startup section so only the reset button is needed. Remember this is only needed about every 2 years, as long as the coin battery remains in place the clock continues to run.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@ajpatrick Can we confirm that what you call a RTC is in fact a battery backed up Real Time clock, you put in the battery, run some code to SET the time ONCE and you can read the current time for a couple of years. This means there is NO reason to have any code to do with initializing the timer in the main loop which obviously includes ALL THE WIFI CODE SINCE IT HAS NO OTHER USE.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@zander yes, i have a ds3231 rtc with battery. the wifi stuff need only run in setup very, very rarely, and this is a problem of my own making because yes, the device works perfectly as is. im just being a bit over the top wanting to have a way of setting the rtc after battery failure that doesn't involve plugging the board in and uploading the whole program again. twice. (once to set the time and then again to comment out the clock setting so it doesn't run every boot).
@ajpatrick Not running every boot is simple, just see if the RTC clock is still reasonable. Check against a date of say 2022-01-01, if it's before then then it has started over. IIRC the date/time format is Unix epoch 70 so zero is equal to 1970-01-01. Pretty obvious check.
This way the only button you need is for printing, when the battery is changed you re-boot, check the RTC date, if it's less than 2022-01-01 or any near current date you want to hard code then the wifi code must be used to get the rtc initialized, otherwise setup is complete. 99.999% of the time you reboot the rtc date will be greater than 2022-01-01 so the clock is current exit setup.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@ajpatrick I have contacted a forum member who is pretty well versed in this wifi stuff but he is travelling. When he gets back the he will tell us how to do the wifi connection so you don't need to enter any passwords in your code. Unless of course you have figured it out. Just be a little more patient.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.
@ajpatrick Once done correctly there will be no need to ever pug the board in again (other than for power of course) and no need to ever modify the code again (unless there is a bug) and certainly no need to upload it twice.
The pseudo code is
void setup(){
get rtc date now
if date from rtc is > 2022-01-01 do nothing // any date past 2000-01-01 but less than now-1 yr
else{
set up wifi connection
get the ntp date
initialize the DS3231
end wifi
}
do any initial rtc tasks that need to be done
} // end of setup
No need to comment anything out or in or change the code or upload it once or twice, this is what programming is.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.