Revert "add am pm light switch"

This reverts commit 2680ce405a.
This commit is contained in:
Terra Gilbert 2022-09-06 13:17:32 -04:00
parent 4e702acf9d
commit 8b486f9597
4 changed files with 1348 additions and 1362 deletions

View file

@ -21,24 +21,24 @@
// nodeMCU - uncomment to compile this sketch for nodeMCU 1.0 / ESP8266, make sure to select the proper board
// type inside the IDE! This mode is NOT supported and only experimental!
#define NODEMCU
// #define NODEMCU
// useWiFi - enable WiFi support, WPS setup only! If no WPS support is available on a router check settings
// further down, set useWPS to false and enter ssid/password there
#define USEWIFI
// #define USEWIFI
// useNTP - enable NTPClient, requires NODEMCU and USEWIFI. This will also enforce AUTODST.
// Configure a ntp server further down below!
#define USENTP
// #define USENTP
// RTC selection - uncomment the one you're using, comment all others and make sure pin assignemts for
// DS1302 are correct in the parameters section further down!
// #define RTC_DS1302
// #define RTC_DS1307
//#define RTC_DS3231
#define RTC_DS3231
// autoDST - uncomment to enable automatic DST switching, check Time Change Rules below!
#define AUTODST
// #define AUTODST
// FADING - uncomment to enable fading effects for dots/digits, other parameters further down below
// #define FADING
@ -101,7 +101,7 @@ RtcDS3231<TwoWire> Rtc(Wire);
/* Start WiFi config/parameters------------------------------------------------------------------------- */
#ifdef USEWIFI
const bool useWPS = false; // set to false to disable WPS and use credentials below
const bool useWPS = true; // set to false to disable WPS and use credentials below
const char* wifiSSID = "maWhyFhy";
const char* wifiPWD = "5up3r1337r0xX0r!";
#endif
@ -113,7 +113,8 @@ const bool useWPS = false; // set to false to disable WPS and use crede
#ifdef USENTP
/* I recommend using a local ntp service (many routers offer them), don't spam public ones with dozens
of requests a day, get a rtc! ^^ */
#define NTPHOST "pool.ntp.org"
//#define NTPHOST "europe.pool.ntp.org"
#define NTPHOST "192.168.2.1"
#ifndef AUTODST
#define AUTODST
#endif
@ -131,12 +132,12 @@ const bool useWPS = false; // set to false to disable WPS and use crede
TimeChangeRule *tcr;
//-----------------------------------------------
/* US */
TimeChangeRule tcr1 = {"tcr1", First, Sun, Nov, 2, -300}; // utc -5h, valid from first sunday of november at 2am
TimeChangeRule tcr2 = {"tcr2", Second, Sun, Mar, 2, -240}; // utc -4h, valid from second sunday of march at 2am
// TimeChangeRule tcr1 = {"tcr1", First, Sun, Nov, 2, -360}; // utc -6h, valid from first sunday of november at 2am
// TimeChangeRule tcr2 = {"tcr2", Second, Sun, Mar, 2, -300}; // utc -5h, valid from second sunday of march at 2am
//-----------------------------------------------
/* Europe */
// TimeChangeRule tcr1 = {"tcr1", Last, Sun, Oct, 3, 60}; // standard/winter time, valid from last sunday of october at 3am, UTC + 1 hour (+60 minutes) (negative value like -300 for utc -5h)
// TimeChangeRule tcr2 = {"tcr2", Last, Sun, Mar, 2, 120}; // daylight/summer time, valid from last sunday of march at 2am, UTC + 2 hours (+120 minutes)
TimeChangeRule tcr1 = {"tcr1", Last, Sun, Oct, 3, 60}; // standard/winter time, valid from last sunday of october at 3am, UTC + 1 hour (+60 minutes) (negative value like -300 for utc -5h)
TimeChangeRule tcr2 = {"tcr2", Last, Sun, Mar, 2, 120}; // daylight/summer time, valid from last sunday of march at 2am, UTC + 2 hours (+120 minutes)
//-----------------------------------------------
Timezone myTimeZone(tcr1, tcr2);
#endif
@ -178,9 +179,9 @@ const uint8_t buttonB = 4; // momentary push
/* Start basic appearance config------------------------------------------------------------------------ */
const bool dotsBlinking = false; // true = only light up dots on even seconds, false = always on
const bool dotsBlinking = true; // true = only light up dots on even seconds, false = always on
const bool leadingZero = false; // true = enable a leading zero, 9:00 -> 09:00, 1:30 -> 01:30...
uint8_t displayMode = 1; // 0 = 24h mode, 1 = 12h mode ("1" will also override setting that might be written to EEPROM!)
uint8_t displayMode = 0; // 0 = 24h mode, 1 = 12h mode ("1" will also override setting that might be written to EEPROM!)
uint8_t colorMode = 0; // different color modes, setting this to anything else than zero will overwrite values written to eeprom, as above
uint16_t colorSpeed = 750; // controls how fast colors change, smaller = faster (interval in ms at which color moves inside colorizeOutput();)
const bool colorPreview = true; // true = preview selected palette/colorMode using "8" on all positions for 3 seconds
@ -254,7 +255,7 @@ bool firstLoop = true;
#define LED_PWR_LIMIT 500 // 500mA - Power limit in mA (voltage is set in setup() to 5v)
#define LED_DIGITS 4 // 4 or 6 digits, HH:MM or HH:MM:SS
#define LED_COUNT 64 // Total number of leds, 103 on Retro 7 Segment Clock v3 - The Final One(s) - 3 LEDs/segment
#define LED_COUNT 103 // Total number of leds, 103 on Retro 7 Segment Clock v3 - The Final One(s) - 3 LEDs/segment
#if ( LED_DIGITS == 6 )
#define LED_COUNT 157 // leds on the 6 digit version
#endif
@ -319,7 +320,7 @@ CRGBPalette16 currentPalette;
*/
// defining access modes for each digit individually
uint8_t digitsLAM[6] = { 0, 0, 0, 0, 0, 0 };
uint8_t digitsLAM[6] = { 1, 1, 1, 1, 1, 1 };
#if ( LED_DIGITS == 4 )
const uint8_t digitPositions[4] = { 0, 1, 2, 3 }; // positions of HH:MM (3, 0, 2, 1 on L7-QBE)
@ -333,37 +334,37 @@ const uint16_t segGroups[28][2] PROGMEM = {
/* segments 0-27, 4 digits x 7 segments */
/* digit position 0 */
{48, 40}, // top, a
{32, 33}, // top right, b
{34, 35}, // bottom right, c
{43, 51}, // bottom, d
{59, 58}, // bottom left, e
{57, 56}, // top left, f
{49, 41}, // center, g
{ 6, 8 }, // top, a
{ 3, 5 }, // top right, b
{ 20, 22 }, // bottom right, c
{ 17, 19 }, // bottom, d
{ 14, 16 }, // bottom left, e
{ 9, 11 }, // top left, f
{ 0, 2 }, // center, g
/* digit position 1 */
{16, 8}, // top, a
{0, 1}, // top right, b
{2, 3}, // bottom right, c
{11, 19}, // bottom, d
{27, 26}, // bottom left, e
{25, 24}, // top left, f
{17, 9}, // center, g
{ 40, 42 }, // top, a
{ 37, 39 }, // top right, b
{ 32, 34 }, // bottom right, c
{ 29, 31 }, // bottom, d
{ 26, 28 }, // bottom left, e
{ 43, 45 }, // top left, f
{ 46, 48 }, // center, g
/* digit position 2 */
{52, 44}, // top, a
{36, 37}, // top right, b
{38, 39}, // bottom right, c
{47, 55}, // bottom, d
{63, 62}, // bottom left, e
{61, 60}, // top left, f
{53, 45}, // center, g
{ 60, 62 }, // top, a
{ 57, 59 }, // top right, b
{ 74, 76 }, // bottom right, c
{ 71, 73 }, // bottom, d
{ 68, 70 }, // bottom left, e
{ 63, 65 }, // top left, f
{ 54, 56 }, // center, g
/* digit position 3 */
{20, 12}, // top, a
{4, 5}, // top right, b
{6, 7}, // bottom right, c
{23, 15}, // bottom, d
{31, 30}, // bottom left, e
{28, 29}, // top left, f
{21, 13}, // center, g
{ 94, 96 }, // top, a
{ 91, 93 }, // top right, b
{ 86, 88 }, // bottom right, c
{ 83, 85 }, // bottom, d
{ 80, 82 }, // bottom left, e
{ 97, 99 }, // top left, f
{ 100, 102 } // center, g
#if ( LED_DIGITS == 6 ) // add two digits, 14 segments, only used if LED_DIGITS is 6...
/* segments 28-41, 6 digits x 7 segments */
/* (bogus on some models which don't support 6 digits) */
@ -387,8 +388,8 @@ const uint16_t segGroups[28][2] PROGMEM = {
};
#if ( LED_DIGITS == 4 )
const uint16_t upperDots[2] PROGMEM = { 50}; // leds inside the upper dots (right on L7-QBE)
const uint16_t lowerDots[2] PROGMEM = { 42}; // leds inside the lower dots (left on L7-QBE)
const uint16_t upperDots[2] PROGMEM = { 49, 50 }; // leds inside the upper dots (right on L7-QBE)
const uint16_t lowerDots[2] PROGMEM = { 52, 53 }; // leds inside the lower dots (left on L7-QBE)
#endif
#if ( LED_DIGITS == 6 )
@ -396,9 +397,6 @@ const uint16_t segGroups[28][2] PROGMEM = {
const uint16_t lowerDots[4] PROGMEM = { 52, 53, 106, 107 }; // all the leds inside the lower dots (bogus values on some models which don't support 6 digits)
#endif
const uint16_t amLight[1] PROGMEM = { 54};
const uint16_t pmLight[1] PROGMEM = { 14};
// Using above arrays it's very easy to "talk" to the segments. Simply use 0-6 for the first 7 segments, add 7 (7-13) for the second one, 14-20 for third....
const uint8_t digits[21][7] PROGMEM = {
/* Lets define 10 numbers (0-9) with 7 segments each, also adding some letters
@ -1524,7 +1522,6 @@ void displayTime(time_t t) {
} else {
showDots(2);
}
showAmPm(isAM(t));
if ( millis() - lastRefresh >= 25 ) {
colorizeOutput(colorMode);
FastLED.show();
@ -1602,27 +1599,16 @@ void showSegment(uint8_t segment, uint8_t segDisplay) {
void showDots(uint8_t dots) {
// // dots 0 = upper dots, dots 1 = lower dots, dots 2 = all dots (right/left/both on Lazy 7 - Quick Build Edition)
// if ( dots == 1 || dots == 2 ) {
// for ( uint8_t i = 0; i < ( sizeof(upperDots) / sizeof(upperDots[0]) ); i++ ) {
// leds[pgm_read_word_near(&upperDots[i])].setHSV(markerHSV[0], markerHSV[1], markerHSV[2]);
// }
// }
// if ( dots == 0 || dots == 2 ) {
// for ( uint8_t i = 0; i < ( sizeof(lowerDots) / sizeof(lowerDots[0]) ); i++ ) {
// leds[pgm_read_word_near(&lowerDots[i])].setHSV(markerHSV[0], markerHSV[1], markerHSV[2]);
// }
// }
// dots 0 = upper dots, dots 1 = lower dots, dots 2 = all dots (right/left/both on Lazy 7 - Quick Build Edition)
if ( dots == 1 || dots == 2 ) {
for ( uint8_t i = 0; i < ( sizeof(upperDots) / sizeof(upperDots[0]) ); i++ ) {
leds[pgm_read_word_near(&upperDots[i])].setHSV(markerHSV[0], markerHSV[1], markerHSV[2]);
}
void showAmPm(bool amFlag){
if (amFlag == false)
{
leds[pgm_read_word_near(&pmLight[0])].setHSV(160, 255, brightness);
}
else
{
leds[pgm_read_word_near(&amLight[0])].setHSV(64, 255, brightness);
if ( dots == 0 || dots == 2 ) {
for ( uint8_t i = 0; i < ( sizeof(lowerDots) / sizeof(lowerDots[0]) ); i++ ) {
leds[pgm_read_word_near(&lowerDots[i])].setHSV(markerHSV[0], markerHSV[1], markerHSV[2]);
}
}
}
@ -2297,11 +2283,11 @@ void customHelper() {
Serial.println(F("Press button A (or send 7 using serial input) to advance to the next step...\n"));
#endif
while ( test == 5 ) {
// if ( second() % 2 == 1 ) {
// showDots(0);
// } else {
// showDots(1);
// }
if ( second() % 2 == 1 ) {
showDots(0);
} else {
showDots(1);
}
if ( inputButtons() != 0 ) test++;
FastLED.show();
delay(20);

BIN
base.stl

Binary file not shown.

Binary file not shown.

Binary file not shown.