6565#define ADR_FRAMELIGHTSECONDSACTIVE 12
6666#define ADR_FRAMELIGHTSECONDSSINGLE 13
6767#define ADR_FRAMELIGHTSECONDSINCDECCYCLE 14
68+ #define ADR_STATICBACKGROUND2 15
6869#define ADR_STATE 26
6970#define ADR_NM_ACTIVATED 27
7071#define ADR_COLSHIFTSPEED 28
@@ -208,6 +209,7 @@ uint8_t dynColorShiftPhase = 0; // stores the phase of the dynamic
208209uint8_t dynColorShiftSpeed = 1 ; // stores the speed of the dynamic color shift -> used to calc update period
209210bool puristModeActive = false ; // stores if purist mode is active
210211bool staticBackgroundActive = false ; // stores if static background is active
212+ bool staticBackground2Active = false ; // stores if static background is active
211213bool frameLightActive = false ; // stores if frame light is active
212214bool frameSecondsActive = false ; // stores if frame light should be active for seconds
213215bool frameSecondsSingle = false ; // stores if frame light should be active for seconds in single mode (false == increment mode)
@@ -440,7 +442,7 @@ void loop() {
440442 Serial.println (" connection lost" );
441443 ledmatrix.gridAddPixel (0 , 5 , colors24bit[1 ]);
442444 ledmatrix.drawOnMatrixInstant ();
443- delay (2000 ); // Sandro 1000
445+ delay (2000 ); // Nessi ( 1000)
444446 }
445447 }
446448
@@ -567,13 +569,9 @@ void updateStateBehavior(uint8_t state){
567569 }
568570 showStringOnClock (timeAsString, maincolor_clock);
569571 drawMinuteIndicator (minutes, maincolor_clock);
570-
571- // show static background pattern every 5 minutes for 1 minute
572- // if(minutes % 5 == 0 && staticBackgroundActive){ // Sandro
573- // showStaticBackgroundPattern(); // Sandro
574- // } // Sandro
575572 }
576573 break ;
574+
577575 // state diclock
578576 case st_diclock:
579577 {
@@ -585,7 +583,7 @@ void updateStateBehavior(uint8_t state){
585583 // state spiral
586584 case st_spiral:
587585 {
588- int res = spiral (false , sprialDir, WIDTH-0 ); // Sandro WIDTH-6);
586+ int res = spiral (false , sprialDir, WIDTH-0 ); // Nessi WIDTH-6);
589587 if (res && sprialDir == 0 ){
590588 // change spiral direction to closing (draw empty leds)
591589 sprialDir = 1 ;
@@ -831,8 +829,8 @@ void handleButton(){
831829 if (ledOff){
832830 ledOff = false ;
833831 }else {
834- // stateChange((currentState + 1) % NUM_STATES, true); // Sandro , umschalten 6 Modi
835- stateChange ((currentState + 1 ) % 2 , true ); // Sandro , umschalten nur Uhr und Digi
832+ // stateChange((currentState + 1) % NUM_STATES, true); // Nessi , umschalten 6 Modi
833+ stateChange ((currentState + 1 ) % 2 , true ); // Nessi , umschalten nur Uhr und Digi
836834 }
837835
838836 }
@@ -881,6 +879,7 @@ void loadCurrentStateFromEEPROM(){
881879
882880 puristModeActive = EEPROM.read (ADR_PURIST_MODE_ACTIVE);
883881 staticBackgroundActive = EEPROM.read (ADR_STATICBACKGROUND);
882+ staticBackground2Active = EEPROM.read (ADR_STATICBACKGROUND2);
884883 frameLightActive = EEPROM.read (ADR_FRAMELIGHTACTIVE);
885884 frameSecondsActive = EEPROM.read (ADR_FRAMELIGHTSECONDSACTIVE);
886885 frameSecondsSingle = EEPROM.read (ADR_FRAMELIGHTSECONDSSINGLE);
@@ -1140,6 +1139,14 @@ void handleCommand() {
11401139 EEPROM.write (ADR_STATICBACKGROUND, staticBackgroundActive);
11411140 EEPROM.commit ();
11421141 }
1142+ else if (server.argName (0 ) == " staticbackground2" ){
1143+ Serial.println (" StaticBackground2 change via Webserver" );
1144+ String str = server.arg (0 );
1145+ if (str == " 1" ) staticBackground2Active = true ;
1146+ else staticBackground2Active = false ;
1147+ EEPROM.write (ADR_STATICBACKGROUND2, staticBackground2Active);
1148+ EEPROM.commit ();
1149+ }
11431150 else if (server.argName (0 ) == " frameLight" ){
11441151 Serial.println (" FrameLight change via Webserver" );
11451152 String str = server.arg (0 );
@@ -1241,6 +1248,8 @@ void handleDataRequest() {
12411248 message += " ," ;
12421249 message += " \" staticbackground\" :\" " + String (staticBackgroundActive) + " \" " ;
12431250 message += " ," ;
1251+ message += " \" staticbackground2\" :\" " + String (staticBackground2Active) + " \" " ;
1252+ message += " ," ;
12441253 message += " \" frameLight\" :\" " + String (frameLightActive) + " \" " ;
12451254 message += " ," ;
12461255 message += " \" frameSecondsActive\" :\" " + String (frameSecondsActive) + " \" " ;
@@ -1279,13 +1288,41 @@ String leadingZero2Digit(int value){
12791288void showStaticBackgroundPattern (){
12801289 // define the coordinates of the background pattern to light up
12811290 // top left corner is (0,0)
1282- uint8_t coordinatesX[] = {4 , 5 , 6 , 7 , 8 , 9 , 10 , 6 , 7 , 8 , 9 , 10 }; // Sandro
1283- uint8_t coordinatesY[] = {3 , 3 , 3 , 3 , 3 , 3 , 3 , 4 , 4 , 4 , 4 , 4 }; // Sandro
1291+ uint8_t coordinatesX[] = {4 , 5 , 6 , 7 , 8 , 9 , 10 }; // Nessi (WORTUHR)
1292+ uint8_t coordinatesY[] = {3 , 3 , 3 , 3 , 3 , 3 , 3 }; // Nessi (NESSI)
12841293
12851294 uint8_t red = 0 ; // red color value (0-255)
12861295 uint8_t green = 255 ; // green color value (0-255)
12871296 uint8_t blue = 0 ; // blue color value (0-255)
1288- uint8_t patternBrightness = 0.9 * brightness; // brightness of the pattern (0-255) // Sandro 0.7 entspricht 70%
1297+ uint8_t patternBrightness = 0.9 * brightness; // brightness of the pattern (0-255) // Nessi 0.7 entspricht 70%
1298+
1299+ if (patternBrightness < 10 ) patternBrightness = 10 ;
1300+ if (patternBrightness > 255 ) patternBrightness = 255 ;
1301+ float factor = patternBrightness / 255.0 ;
1302+ uint32_t color = LEDMatrix::Color24bit (red * factor, green * factor, blue * factor);
1303+ ledmatrix.setDynamicColorShiftPhase (-1 );
1304+ for (uint8_t i = 0 ; i < sizeof (coordinatesX); i++) {
1305+ ledmatrix.gridAddPixel (coordinatesX[i], coordinatesY[i], color);
1306+ }
1307+ }
1308+
1309+ /* *
1310+ * @brief Show a second static background pattern on the matrix
1311+ *
1312+ * You can define which leds should be lit up by changing the coordinatesX and coordinatesY arrays.
1313+ * You can define the color by changing the color variable.
1314+ *
1315+ */
1316+ void showStaticBackgroundPattern2 (){
1317+ // define the coordinates of the background pattern to light up
1318+ // top left corner is (0,0)
1319+ uint8_t coordinatesX[] = { 6 , 7 , 8 , 9 , 10 }; // Nessi (WORTUHR)
1320+ uint8_t coordinatesY[] = { 4 , 4 , 4 , 4 , 4 }; // Nessi (NESSI)
1321+
1322+ uint8_t red = 0 ; // red color value (0-255)
1323+ uint8_t green = 0 ; // green color value (0-255)
1324+ uint8_t blue = 255 ; // blue color value (0-255)
1325+ uint8_t patternBrightness = 0.9 * brightness; // brightness of the pattern (0-255) // Nessi 0.7 entspricht 70%
12891326
12901327 if (patternBrightness < 10 ) patternBrightness = 10 ;
12911328 if (patternBrightness > 255 ) patternBrightness = 255 ;
0 commit comments