Browse Source

Fix Day/Night hour interpretation.

Vladimir N. Shilov 2 years ago
parent
commit
ac3d2690a2
1 changed files with 12 additions and 12 deletions
  1. 12 12
      Src/clock.c

+ 12 - 12
Src/clock.c

@@ -690,15 +690,15 @@ void showDNhour(void) {
   es_state_t e_st = ES_GetState();
 
   if (e_st == stShowDNhours){
-    buf.s8.tA = Lighting.name.DayHour / 10;
-    buf.s8.tB = Lighting.name.DayHour % 10;
-    buf.s8.tD = Lighting.name.NightHour / 10;
-    buf.s8.tE = Lighting.name.NightHour % 10;
+    buf.s8.tA = Lighting.name.DayHour >> 4;
+    buf.s8.tB = Lighting.name.DayHour & 0xf;
+    buf.s8.tD = Lighting.name.NightHour >> 4;
+    buf.s8.tE = Lighting.name.NightHour & 0xf;
   } else {
-    buf.s8.tA = setLighting.name.DayHour / 10;
-    buf.s8.tB = setLighting.name.DayHour % 10;
-    buf.s8.tD = setLighting.name.NightHour / 10;
-    buf.s8.tE = setLighting.name.NightHour % 10;
+    buf.s8.tA = setLighting.name.DayHour >> 4;
+    buf.s8.tB = setLighting.name.DayHour & 0xf;
+    buf.s8.tD = setLighting.name.NightHour >> 4;
+    buf.s8.tE = setLighting.name.NightHour & 0xf;
   }
   showDigits(buf);
 }
@@ -856,7 +856,7 @@ void setNightColourBegin(void) {
 }
 
 void setIncDayHour(void) {
-  dvalIncrease(&setLighting.name.DayHour, 23);
+  valIncrease(&setLighting.name.DayHour, 23);
 }
 
 void setIncDayBright(void) {
@@ -874,7 +874,7 @@ void setIncDayColour(void) {
 }
 
 void setDecDayHour(void) {
-  dvalDecrease(&setLighting.name.DayHour, 23);
+  valDecrease(&setLighting.name.DayHour, 23);
 }
 
 void setDecDayBright(void) {
@@ -892,7 +892,7 @@ void setDecDayColour(void) {
 }
 
 void setIncNightHour(void) {
-  dvalIncrease(&setLighting.name.NightHour, 23);
+  valIncrease(&setLighting.name.NightHour, 23);
 }
 
 void setIncNightBright(void) {
@@ -910,7 +910,7 @@ void setIncNightColour(void) {
 }
 
 void setDecNightHour(void) {
-  dvalDecrease(&setLighting.name.NightHour, 23);
+  valDecrease(&setLighting.name.NightHour, 23);
 }
 
 void setDecNightBright(void) {