wvmarle:
Didn't touch it beyond commenting out the lines (and restoring them later - hopefully all).
Gonna be tricky without test bed. I have to have a look at it.
It also shows that when the minutes roll over, the hour is increased. Is that your intended behaviour for setting the clock?
The intended working of the buttons is also a bit of a mystery to me.
That works at all times? So whenever you press buttonHour the hour is increased by 1? Same for the buttonMinute? I'm a bit confused with this.
What are "alarmmode" and "clockmode", really?
That I pretty much figured.
For those buttons, best you give me a description of their intended behaviour. I have the feeling some more improvements can be made here.
Have you had a chance to install it on your clock again? Mostly hoping I didn't mess up the special effects and so.
Hi. OK, sure, I will give your their description now:
-
So, about buttonMinute and buttonHour. They always work the same way. to set minutes and hours. And only that. In clock mode and in alarm mode. As per increasing the hour by 1, if the minutes roll over. Yes, it was indeed my intention which I'd like to keep if possible. So, I was intending to make it so that, you set minutes with "buttonMinute" and hours with "buttonHour". If minutes roll over, increase the hour also. if hour is 24, reset everything to 0. I like how the time setting buttons worked. You think we do it another way? Please explain in more detail if you can.
-
The clock was intended to have 2 modes. 1. Clock mode. 2. alarm mode. Clock mode is for showing time in binary coded decimal format. hh:mm. Alarm mode is for setting alarm time. You switch modes with buttonAlarm. So, for example, when the clock is first powered on, you are automatically in clock mode. And alarm is off by default.
If you want to set alarmtime, you press buttonAlarm once and it moves you from Clock mode to alarm mode. So you are in alarm mode now but alarm is not active yet. to set and activate alarm you press hour/min buttons together. Now, you are in alarm mode and alarm is active and you can set alarm time. when done setting alarm time you just click the buttonAlarm again, and this time it takes you back to clock mode.
so, to summerize, buttonAlarm takes you between modes (clock and alarm) and it acts like mode changing button. But it is also used to cancel the alarm. If the alarm is playing, and if you press the buttonAlarm, it cancels the alarm and deactivates the alarm. it was anyway, in the old code.
And in alarm mode, pressing hour/min together activates and deactivates the alarm.
TEST RESULTS SO FAR:
I looked at the code. I like the changes you've made so far. Especially the visual pattern editting capability in specialEffects() function. Unfortunately, I was not able to do any testing. Because for some reason the code is not working. I ran the code as is, without any changes to the wiring. Because I'm not entirely sure what exactly I need to change in wiring.
Please excuse my lack of knowledge. I have 4 buttons right now, do you mean to introduce a 5th button as an interrupter? or do you mean to connect buttonAlarm to interrupt pin which is digital pin 2 or 3?
So, there seem to be some outstanding issues. It would be nice if we could try and clear them. I really like the new code layout of yours and I certainly don't want to have to use the old code The code is probably OK, could be that just a small thing needs to be changed. Anyway, below I have tried to summerize the issues that I can see. I was not able to do any deep testing of functions, clock and alarm modes etc. because I don't know what is going on with LEDs.
When I power up the clock, no matter how many times I press hour/minute buttons, the only LEDs that light up are the ones that correspond to 0, 1, 2 and 3 on the original LED layout matrix. But they light up erratically, not in any sequence that would make sense. Also, they don't light up normally. As I press the "set hour/set minute" buttons, those LEDs (0, 1, 2, 3 on matrix) sort of dim and flicker and do weird things. Never happened in old code. Could it be because I have not changed the wiring as you suggested?
I think at this point it is difficult to test other things, because the LEDs don't turn on the way they should. But I was able to make note of something. It is about specialEffects(). I was able to toggle through min/hour buttons and get the specialEffects() function to run (without visual indication of time on LEDs) and the specialEffects() actually ran OK, but it looks like it is still playing at every hour sharp even though you are in the process of setting time, which I don't want to happen. I want specialEffects() to play only if the hour becomes 00:00:00 naturally. So, in the process of setting time, I don't want this to happen.
-
Also, as I mentioned in the main post, if specialEffects() and playAlarm() times coincide, I want only playAlarm() to play as priority and completely skip specialEffects().
-
buttonOnOff seems to toggle LEDs on/off OK in normal modes. But when the specialEffects() is playing, it does nothing.