Go Down

Topic: Need help to finish the code (Read 2882 times) previous topic - next topic

arduinoware

RTC is good as it is, that only takes time to probe so often.

Debounce at 100 ms means you have to slow down your presses to less than 10 a second, and hold the button for that time for a press to register. Most humans can't press that fast so that shouldn't be a problem :-) If you do 3-4 presses a second you're pretty fast already.
I just noticed that, the following issue now happens:

In SETTING MODE, if you toggle between alarm setting and clock setting modes, every time you go to the clock setting mode, the display shows a different (random) time. when toggling between modes without storing time. if you store and come back again to clock mode, again there is a random time.

Definitely was not there before. may be, that is even somehow related to the jumping issue of setting hour/minute buttons.

Can you check? I'm really tired of this. Probably, so are you. But we have to finish this thing eventually.

Thanks.

arduinoware

And making the debounce 100ms, didn't help with jumping value.

So, something still wrong with the code. somewhere.

wvmarle

Rolled back the RTC changes. Hope it work - it means I can't test any more. This should take care of the randomness issue (which is totally bizarre anyway).

That's it for tonight from me. Have to get up really early tomorrow.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

arduinoware

#93
Jan 19, 2018, 05:21 pm Last Edit: Jan 19, 2018, 08:17 pm by arduinoware
Rolled back the RTC changes. Hope it work - it means I can't test any more. This should take care of the randomness issue (which is totally bizarre anyway).

That's it for tonight from me. Have to get up really early tomorrow.
Hi,

I am planning to send you a heavy paypal gift. Which I sincerely think you have deserved already. I understand that you've already spent a ton of time on it. But at this point, I really cannot do that until I see this project complete. I have tried all I can. Including delaying my flight and many recordings of issues and tests. I still do hope that you will fix it. And everybody will be happy eventually. We have come so close, and yet, this annoying issue....

The randomness is gone, but in SETTING MODE, the hour/minute value jumping issue is still there. Like I said, hours do it more often than minutes. I'm 100% sure it is the code, because I tried some other basic codes from the internet and it doesn't happen.

ALSO, you have rolled back the "RTC 10 minute probing thing" but in software there is still "TimeLib.h" and "RTC INTERVAEL 600000" in global area of the sketch. may be some remaining redundant codes also causing some issues?


*******************************
Can you please make sure all redundant stuff is gone? so that it won't cause problems in the future if I accidentally uncomment them (because right now some stuff, is just commented out, like "TimeLib.h" or "RTC interval 600000" which are related to recent RTC change for 10 minute probing.
*******************************

I will give you some more clue, perhaps it might help:

I tried changing the debounce delay to 100ms. And I noticed that with 100ms debounce delay, if I physically single click the "minute" and "hour" at the same speed in quick succesions, the minute button registers better. The hour button registers slightly worse, will skip some of the inputs. This is directly proportional with the fact that hour buttons jumps more than minute buttons. At least, according to my observation.

By the way, remember the button echoing glitches before we removed button sounds? Well, in SETTING MODE, that sound glitch was happening just as often, in case that is somehow relevant.

And the problem is not the physical button. I have ruled that out. by trying another button and also by trying another code. I think we are having a code issue here.

Also, please check the blinking code IN SETTING MODE, may be that is interfering somehow. There is got to be some issue somewhere. Otherwise, it wouldn't do that.

I am looking forward to hearing from you soon.

Sincerely,
Anar N.H.

wvmarle

Added a bunch of print statements. Run this with Serial monitor open, speed 115200, and try to reproduce the problem. Hoping the print() statements don't suddenly cause it to work as of course those do affect (slow down) the code.

You should see a message every time the clock or alarm is advanced when selecting it.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

wvmarle

Another one to test: with the print statements, and the button handling slowed down significantly. You'll notice you can't press that fast (no more than two button presses a second). Also the longpress and repeat rate have doubled in this sketch.

See what happens here.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

wvmarle

When you got some results please copy/paste the messages you get on the Serial monitor and post it back here. Then this afternoon when I'm done with my tour I'll see them and hope to gain some clues about what's really going on.

The simulator you suggested is just that, a simulator, it's not the real thing. Maybe nice for basic practice, I don't see any use in debugging this kind of weird behaviour which can very well turn out to be some odd interaction with your hardware, and that can't be simulated without knowing exactly what's going on in the first place.

The weirdest part is still the difference in behaviour between the two buttons.

And then I suddenly think of yet another test: switching the hour and minute buttons. The here attached sketch has no print statements or slowdown, it just swapped out pin definitions for the hour and minute button (so to set the minute, press the hour button, and the other way around). See what happens. Does the hour advance much more than the minute now? Or do you see no change in this behaviour?

Finally I have still no clue what could possibly cause the randomness when I switched to the internal timekeeping. That part also just doesn't make sense to me.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

arduinoware

When you got some results please copy/paste the messages you get on the Serial monitor and post it back here. Then this afternoon when I'm done with my tour I'll see them and hope to gain some clues about what's really going on.

The simulator you suggested is just that, a simulator, it's not the real thing. Maybe nice for basic practice, I don't see any use in debugging this kind of weird behaviour which can very well turn out to be some odd interaction with your hardware, and that can't be simulated without knowing exactly what's going on in the first place.

The weirdest part is still the difference in behaviour between the two buttons.

And then I suddenly think of yet another test: switching the hour and minute buttons. The here attached sketch has no print statements or slowdown, it just swapped out pin definitions for the hour and minute button (so to set the minute, press the hour button, and the other way around). See what happens. Does the hour advance much more than the minute now? Or do you see no change in this behaviour?

Finally I have still no clue what could possibly cause the randomness when I switched to the internal timekeeping. That part also just doesn't make sense to me.
I read your posts. I will do the tests now. But what exactly do you mean by "openning serial monitor? " is that a hardware or some display within arduino IDE? Also should I remove pin 0 and 1 for serial traffic to work? Or do tests with 0 and 1 connected.

I am not sure what I am supposed to look at.

But give me some clues and I will see what I can do. We have to nail it. No other way :)

arduinoware

This is the test results of the 1st code of the 3, which you sent me: arduinoware_sketch_print.ino

Please note that somehow the RTC INTERVAL things was in void SETUP again, and wouldn't let me compile it so I removed it. I thought you'd rolled that back. you must have multiple versions of the code. But just, please don't mix them up.

TEST RESULTS:

**************************************************
What happens is that I just press and release in quick successions (but NOT longPress) and occasionally, I can see that a single click registers like 4-7 advances in one click. So, apparently, the values only jump forward.
**************************************************

24220 MODE_SET_ALARM incrementing hour to 0
24468 MODE_SET_ALARM incrementing hour to 1
25024 MODE_SET_ALARM incrementing hour to 2
25332 MODE_SET_ALARM incrementing hour to 3
25622 MODE_SET_ALARM incrementing hour to 4
25947 MODE_SET_ALARM incrementing hour to 5
26263 MODE_SET_ALARM incrementing hour to 6
26585 MODE_SET_ALARM incrementing hour to 7
26886 MODE_SET_ALARM incrementing hour to 8
28549 MODE_SET_ALARM incrementing hour to 9
28882 MODE_SET_ALARM incrementing hour to 10
29271 MODE_SET_ALARM incrementing hour to 11
31368 MODE_SET_ALARM incrementing hour to 12
31654 MODE_SET_ALARM incrementing hour to 13
31968 MODE_SET_ALARM incrementing hour to 14
32252 MODE_SET_ALARM incrementing hour to 15
32530 MODE_SET_ALARM incrementing hour to 16
36198 MODE_SET_ALARM incrementing hour to 17
36578 MODE_SET_ALARM incrementing hour to 18
36912 MODE_SET_ALARM incrementing hour to 19
37170 MODE_SET_ALARM incrementing hour to 20
37410 MODE_SET_ALARM incrementing hour to 21
37629 MODE_SET_ALARM incrementing hour to 22
37877 MODE_SET_ALARM incrementing hour to 23
39258 MODE_SET_ALARM incrementing hour to 0
39710 MODE_SET_ALARM incrementing hour to 1
40055 MODE_SET_ALARM incrementing hour to 2
40331 MODE_SET_ALARM incrementing hour to 3
40332 MODE_SET_ALARM incrementing hour to 4
40333 MODE_SET_ALARM incrementing hour to 5
40573 MODE_SET_ALARM incrementing hour to 6
40817 MODE_SET_ALARM incrementing hour to 7
41065 MODE_SET_ALARM incrementing hour to 8
41306 MODE_SET_ALARM incrementing hour to 9
41307 MODE_SET_ALARM incrementing hour to 10
41309 MODE_SET_ALARM incrementing hour to 11
41544 MODE_SET_ALARM incrementing hour to 12
41780 MODE_SET_ALARM incrementing hour to 13
42043 MODE_SET_ALARM incrementing hour to 14
42044 MODE_SET_ALARM incrementing hour to 15
42046 MODE_SET_ALARM incrementing hour to 16
45677 MODE_SET_ALARM incrementing hour to 17
46071 MODE_SET_ALARM incrementing hour to 18
46383 MODE_SET_ALARM incrementing hour to 19
46735 MODE_SET_ALARM incrementing hour to 20
47053 MODE_SET_ALARM incrementing hour to 21
47380 MODE_SET_ALARM incrementing hour to 22
47684 MODE_SET_ALARM incrementing hour to 23
47953 MODE_SET_ALARM incrementing hour to 0
48244 MODE_SET_ALARM incrementing hour to 1
48246 MODE_SET_ALARM incrementing hour to 2
48247 MODE_SET_ALARM incrementing hour to 3
48551 MODE_SET_ALARM incrementing hour to 4
48841 MODE_SET_ALARM incrementing hour to 5
48842 MODE_SET_ALARM incrementing hour to 6
48844 MODE_SET_ALARM incrementing hour to 7
52636 MODE_SET_ALARM incrementing hour to 8
53249 MODE_SET_ALARM incrementing hour to 9
53557 MODE_SET_ALARM incrementing hour to 10
53803 MODE_SET_ALARM incrementing hour to 11
54085 MODE_SET_ALARM incrementing hour to 12
54332 MODE_SET_ALARM incrementing hour to 13
54333 MODE_SET_ALARM incrementing hour to 14
54335 MODE_SET_ALARM incrementing hour to 15
54339 MODE_SET_ALARM incrementing hour to 16
54602 MODE_SET_ALARM incrementing hour to 17
54867 MODE_SET_ALARM incrementing hour to 18
55733 MODE_SET_ALARM incrementing hour to 19
56020 MODE_SET_ALARM incrementing hour to 20
56290 MODE_SET_ALARM incrementing hour to 21
56551 MODE_SET_ALARM incrementing hour to 22
56784 MODE_SET_ALARM incrementing hour to 23
57043 MODE_SET_ALARM incrementing hour to 0
57305 MODE_SET_ALARM incrementing hour to 1
57571 MODE_SET_ALARM incrementing hour to 2
57831 MODE_SET_ALARM incrementing hour to 3
59249 MODE_SET_ALARM incrementing hour to 4
59250 MODE_SET_ALARM incrementing hour to 5
59252 MODE_SET_ALARM incrementing hour to 6
59744 MODE_SET_ALARM incrementing hour to 7
60540 MODE_SET_ALARM incrementing hour to 8
60893 MODE_SET_ALARM incrementing hour to 9
61204 MODE_SET_ALARM incrementing hour to 10
61519 MODE_SET_ALARM incrementing hour to 11
61850 MODE_SET_ALARM incrementing hour to 12
62203 MODE_SET_ALARM incrementing hour to 13
62508 MODE_SET_ALARM incrementing hour to 14
62509 MODE_SET_ALARM incrementing hour to 15
62511 MODE_SET_ALARM incrementing hour to 16
62828 MODE_SET_ALARM incrementing hour to 17
63562 MODE_SET_ALARM incrementing hour to 18
64005 MODE_SET_ALARM incrementing hour to 19
64405 MODE_SET_ALARM incrementing hour to 20
64755 MODE_SET_ALARM incrementing hour to 21
64756 MODE_SET_ALARM incrementing hour to 22
65370 MODE_SET_ALARM incrementing hour to 23
65652 MODE_SET_ALARM incrementing hour to 0
65917 MODE_SET_ALARM incrementing hour to 1
66156 MODE_SET_ALARM incrementing hour to 2
66157 MODE_SET_ALARM incrementing hour to 3
66159 MODE_SET_ALARM incrementing hour to 4
66374 MODE_SET_ALARM incrementing hour to 5
66375 MODE_SET_ALARM incrementing hour to 6
66377 MODE_SET_ALARM incrementing hour to 7
66597 MODE_SET_ALARM incrementing hour to 8
66828 MODE_SET_ALARM incrementing hour to 9
67047 MODE_SET_ALARM incrementing hour to 10
67247 MODE_SET_ALARM incrementing hour to 11
67441 MODE_SET_ALARM incrementing hour to 12
67646 MODE_SET_ALARM incrementing hour to 13
67647 MODE_SET_ALARM incrementing hour to 14
67649 MODE_SET_ALARM incrementing hour to 15
67851 MODE_SET_ALARM incrementing hour to 16
67852 MODE_SET_ALARM incrementing hour to 17
67854 MODE_SET_ALARM incrementing hour to 18
68285 MODE_SET_ALARM incrementing hour to 19
68499 MODE_SET_ALARM incrementing hour to 20
68712 MODE_SET_ALARM incrementing hour to 21

arduinoware

Second test for arduinoware_sketch_print_slow.ino

With buttons slowed down, it still does that. I get a feeling that occasionally, it doesn't register certain clicks and then later on it just combines the skipped clicks, but I'm not sure. Sometimes, it registers all the clicks in pressing sequence but still does that.

*******************************

190061 MODE_SET_ALARM incrementing hour to 22
190593 MODE_SET_ALARM incrementing hour to 23
191145 MODE_SET_ALARM incrementing hour to 0
191906 MODE_SET_ALARM incrementing hour to 1
192532 MODE_SET_ALARM incrementing hour to 2
193185 MODE_SET_ALARM incrementing hour to 3
193862 MODE_SET_ALARM incrementing hour to 4
197850 MODE_SET_ALARM incrementing hour to 5
197851 MODE_SET_ALARM incrementing hour to 6
199858 MODE_SET_ALARM incrementing hour to 7
201980 MODE_SET_ALARM incrementing hour to 8
202784 MODE_SET_ALARM incrementing hour to 9
203757 MODE_SET_ALARM incrementing hour to 10
204576 MODE_SET_ALARM incrementing hour to 11
205235 MODE_SET_ALARM incrementing hour to 12
206701 MODE_SET_ALARM incrementing hour to 13
207254 MODE_SET_ALARM incrementing hour to 14
207687 MODE_SET_ALARM incrementing hour to 15
208978 MODE_SET_ALARM incrementing hour to 16
216828 MODE_SET_ALARM incrementing hour to 17
217440 MODE_SET_ALARM incrementing hour to 18
217961 MODE_SET_ALARM incrementing hour to 19
218505 MODE_SET_ALARM incrementing hour to 20
219194 MODE_SET_ALARM incrementing hour to 21
219195 MODE_SET_ALARM incrementing hour to 22
219649 MODE_SET_ALARM incrementing hour to 23
220286 MODE_SET_ALARM incrementing hour to 0
220908 MODE_SET_ALARM incrementing hour to 1
221443 MODE_SET_ALARM incrementing hour to 2
221885 MODE_SET_ALARM incrementing hour to 3
224121 MODE_SET_ALARM incrementing hour to 4
225230 MODE_SET_ALARM incrementing hour to 5
226025 MODE_SET_ALARM incrementing hour to 6
226702 MODE_SET_ALARM incrementing hour to 7
227325 MODE_SET_ALARM incrementing hour to 8
227937 MODE_SET_ALARM incrementing hour to 9
228533 MODE_SET_ALARM incrementing hour to 10
229093 MODE_SET_ALARM incrementing hour to 11
230112 MODE_SET_ALARM incrementing hour to 12
230904 MODE_SET_ALARM incrementing hour to 13
231700 MODE_SET_ALARM incrementing hour to 14
232216 MODE_SET_ALARM incrementing hour to 15
232640 MODE_SET_ALARM incrementing hour to 16
233523 MODE_SET_ALARM incrementing hour to 17
233524 MODE_SET_ALARM incrementing hour to 18
233526 MODE_SET_ALARM incrementing hour to 19
233530 MODE_SET_ALARM incrementing hour to 20
233534 MODE_SET_ALARM incrementing hour to 21
233538 MODE_SET_ALARM incrementing hour to 22
233542 MODE_SET_ALARM incrementing hour to 23
233546 MODE_SET_ALARM incrementing hour to 0

arduinoware

For the 3rd test, you've forgotten to remove the "0 and 1 pins solid ON thing". Because of serial monitor you'd made it so that 2 lights were solid ON. So, it is difficult to test with that setup. I can't test properly.

But after swapping button codes, so, I'm using minute button to set hours and hour are advancing a lot better now, it jumps very rare if I press the button real quick and jumps only by a value of 1 or 2. But definitely better now. not sure what that means.

But I can't test setting the minute with hour button now, because those 2 solid lights ON.

So with the swap, the problem has moved over probably.

Hope that helps.

Please keep in touch and let me know about updates.


wvmarle

This should solve the jumping.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

wvmarle

And another one to try and figure out what's really going on under the hood - with some extra print statements. I'd like to see the output (especially the part where the jumps happen), to get a better idea of where the underlying problem really is.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

arduinoware

And another one to try and figure out what's really going on under the hood - with some extra print statements. I'd like to see the output (especially the part where the jumps happen), to get a better idea of where the underlying problem really is.
So, is this one still with faulty code? I should try this one first right?

Cheers

arduinoware

#104
Jan 20, 2018, 03:30 pm Last Edit: Jan 20, 2018, 03:32 pm by arduinoware
And another one to try and figure out what's really going on under the hood - with some extra print statements. I'd like to see the output (especially the part where the jumps happen), to get a better idea of where the underlying problem really is.
Please check the attachment. I had to do a lot of presses to get the jumping to occur. There are a lot of statements this time, so a few clicks were generating a page of statements. :)

I had to make a pdf file, "word" files don't go through the post.

Hopefully, it will give you some clues.

Go Up