File tree Expand file tree Collapse file tree 4 files changed +27
-9
lines changed Expand file tree Collapse file tree 4 files changed +27
-9
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ class Transition {
198
198
// ------------------------------------------------------------------------------
199
199
// Loop Helper Functions
200
200
// ------------------------------------------------------------------------------
201
- void demoMode (uint8_t &_minute, uint8_t _second);
201
+ void demoMode (uint8_t &_hour, uint8_t & _minute, uint8_t _second);
202
202
void initTransitionStart ();
203
203
bool hasMinuteChanged ();
204
204
bool isOverwrittenByTransition (WordclockChanges flag, uint8_t minute);
Original file line number Diff line number Diff line change @@ -1110,16 +1110,34 @@ uint16_t Transition::transitionSnake() {
1110
1110
// Loop Helper Functions
1111
1111
// ------------------------------------------------------------------------------
1112
1112
1113
- void Transition::demoMode (uint8_t &_minute, uint8_t _second) {
1114
- static uint8_t test_second = 0 ;
1115
- static uint8_t test_minute = 45 ;
1113
+ void Transition::demoMode (uint8_t &_hour, uint8_t &_minute, uint8_t _second) {
1114
+ static uint8_t test_second = _second;
1115
+ static uint8_t test_minute = _minute;
1116
+ static uint8_t test_hour = _hour;
1116
1117
if (G.transitionDemo ) {
1117
- if (isIdle () && ((_second % 10 ) == 0 ) && (test_second != _second)) {
1118
- test_minute += 5 ;
1118
+ // increment every second
1119
+ // by checking isIdle transitions are completely done
1120
+ if (isIdle () && ((_second % 2 ) == 0 ) && (test_second != _second)) {
1121
+ // select increment by clock type
1122
+ if (usedUhrType != nullptr ) {
1123
+ if (usedUhrType->hasOnlyQuarterLayout ()) {
1124
+ test_minute += 15 ;
1125
+ } else if (usedUhrType->has60MinuteLayout ()) {
1126
+ test_minute += 1 ;
1127
+ } else {
1128
+ test_minute += 5 ;
1129
+ }
1130
+ }
1131
+ // add one hour every 60 minutes
1119
1132
if (test_minute >= 60 ) {
1120
- test_minute = _minute % 5 ;
1133
+ test_minute %= 60 ;
1134
+ test_hour = (test_hour + 1 ) % 24 ;
1121
1135
}
1136
+ // log demo time
1137
+ Serial.printf (" Demo time: %02d:%02d\n " , test_hour, test_minute);
1122
1138
}
1139
+ // set to time variables
1140
+ _hour = test_hour;
1123
1141
_minute = test_minute;
1124
1142
test_second = _second;
1125
1143
}
Original file line number Diff line number Diff line change @@ -1101,7 +1101,7 @@ void ClockWork::loop(struct tm &tm) {
1101
1101
previousMillis = currentMillis;
1102
1102
1103
1103
// Faster runtime for demo
1104
- transition->demoMode (_minute, _second);
1104
+ transition->demoMode (_hour, _minute, _second);
1105
1105
1106
1106
// ------------------------------------------------
1107
1107
// Secounds and LDR Routine
Original file line number Diff line number Diff line change @@ -485,7 +485,7 @@ void loop() {
485
485
transition->loop (tm); // must be called periodically
486
486
487
487
// make the time run faster in the demo mode of the transition
488
- transition->demoMode (_minute, _second);
488
+ transition->demoMode (_hour, _minute, _second);
489
489
490
490
if (usedUhrType->numPixelsFrameMatrix () != 0 ) {
491
491
secondsFrame->loop ();
You can’t perform that action at this time.
0 commit comments