/* Clock Firmware for the ESP32 series of boards and nixie clock PN Z57xM6DV2 available at www.neonixie.com/Z57xM6DV2/ * Copyright © 2023 Neonixie.com, All Spectrum * Permission for use and modification is provided for clocks purchased from us. * Software is provided as-is, with no warranty expressed or implied. * * YOU SHOULD NOT PUT THIS DEVICE ON THE PUBLIC INTERNET - KEEP IT BEHIND A ROUTER/FIREWALL! * * Auth info * - Web based firmware update: * Z57XM6DV2: http username = "z57clock" password = "neonixie.com"; * IV-9-6D-RR: http username = "iv9clock" password = "neonixie.com"; * - Arduino OTA firmware update, username = "neonixie.com" * - mDNS hostname, usually used with Arduino OTA or local network: * Z57XM6DV2: Z57clock-MAC_ADDRESS (Z57clock-MAC_ADDRESS.local) * IV-9-6D-RR: iv9clock-MAC_ADDRESS (iv9clock-MAC_ADDRESS.local) * - SSID when clock is in AP mode/SETUP mode (or when unable to connect to configured access point): * Z57XM6DV2: SSID = "z57clock" password = "neonixie.com" * IV-9-6D-RR: SSID = "iv9clock" password = "neonixie.com" * * Revision History * 0.90 07-31-2022 First public release * * 0.91 not final NOTE: Version 0.91 BETA4 is considered release quality since no major bugs have been found * Add Cathode poisoning prevention options * Add date display options * Add leading zero blanking option * Add AutoConnect OTA Web based uploading of new firmware * Add temperature and humidity compensation options * Add temperature display every X seconds and duration options, removed temperature display tickbox * Add correct temperature display code for degree F at or above 100 * Moved struct tm timeinfo; to GLOBAL * Add total uptime in days and total cumulative runtime in days (stored in non-volatile flash) * Add temperature, humidity, lux, version, uptime and total runtime to main web page on device * Code cleanup, move original time code (before timezone support) to extra-code.txt * Changed bootup IP address display to full IP address (prior code only displayed last two octets) * Added code to reset permanent (flash / like eeprom) variables in case of corruption or incorrect values cause a crash that we cannot recover from * This is done by grounding pin 15 on the ESP while the board is reset/powered up. The display will flash all 0's three times to indicate * that flash variables have been reset to default values. TOTAL_RUNTIME is preserved. * Added watchdog timer of 300 seconds. Mainly to force the clock to attempt to reconnect to wifi when in soft AP mode. Should not get triggered in any other mode. * Added config.autoReconnect = true; to make wifi attempt a reconnect to known routers. Without this if the wifi router went offline, the clock would not reconnect. * BETA4, Removed a return from initTime, was causing timezone not to set sometimes at initial bootup * BETA4, Removed free memory display on main http page * BETA4, Changed light sensor default to off in eeprom * BETA4, Added default brightness variable in setup(), without this if light sensor was selected and none was present display would be blank * BETA4, Change default sleep time to display IP address from 2s to 4s * BETA4, Removed extra getLocalTime function and a few lines around it in cathodepp() function * BETA4, Modified ArduinoOTA.setHostname to shorten local hostname, was full MAC now Z57clock-[last-two-octets-of-MAC] * * 0.92 BETA1 UNIV FIRST UNIVERSAL CODEBASE FOR IV-9-6D-RR and Z57XM6DV2. Sourced from Z57XM6DV2 code v0.91 BETA4 * Arduino IDE 1.8.19, ESP32 board manager v2.0.6, AutoConnect v1.4.0, Adafruit_BMP280_Library v2.6.6, Adafruit_AHTX0 v2.0.1 * MAIN CHANGES: * Added preprocessor defines for clock type and autodetection of board type used * Several serial_debugxxx preprocessor defines added for Serial.Printxxx statements to remove serial output when not needed * Driver mapping include file name changed to driver-mapping-definitions.h * Added full alphabet support to driver-mapping-definitions.h for IV-9 clock * HTML config page text moved to html-definitions.h * Added esp_partition.h and related code to display partition information, mainly sizes, linked at main http page * Added code to read BMP280, added read options on configuration page and display results on main web page * Added code to enable/disable colon indicators to main and config web pages * Added code to handle "Tubes on bottom of PCB" to main and config web pages for IV-9 clock * Added code for "Alternate Display" option. Options are standard (clock), altimeter, RSSI, Lux and Barometer (HG) * Moved decimal point code outside of write_display function and related changes * PWM dimming set to 1,600 hz * Added code to set default brightness in settings to 165 for IV-9-6D-RR and 255 for Z57XM6DV2 * Removed delay(20) in main loop * Changes made to various hostname settings to fix issues caused by upgrading the ESP32 board manager * When upgrading the ESP32 board manager from 1.0.6 to 2.0.5 hostnames (softAP hostname, wifi/dhcp hostname and MDNS) were initially not setting correctly, they would be ESP32xxxx defaults * now working as before after several code modifications * * 0.92 BETA2 UNIV UNIVERSAL CODEBASE FOR IV-9-6D-RR and Z57XM6DV2 * Arduino IDE 1.8.19, ESP32 board manager v2.0.8, AutoConnect v1.4.0, Adafruit_BMP280_Library v2.6.6, Adafruit_AHTX0 v2.0.1 * PubSubClient by Nick O’Leary v2.8.0, AnyRtttl v2.2.1 * MAIN CHANGES: * - Added digit cross fading * - Added MQTT client to publish sensor values and set brightness of clock * - Added alarm feature, including audio playback of RTTTL ringtones via a piezo element * - Added timed brightness feature to automatically adjust clock brightness on specific days/times * - Added feature on IV-9 clock to keep unlit segments warm to lower inrush current and hopefully make the tubes last longer (Segment keep-warm ratio in Advanced Config) * - Added field to allow a user specified NTP server * - Added Quickboot option that will bypass Lamp Check and IP display when enabled * - Added "Clock Config Advanced" and moved less used options to that page * - Added minimum brightness setting (for sensor controlled brightness) in advanced config. * Changed Z57 mid level lux controlled brightness to a value between max bright and min bright. This now matches how the IV9 clock works. * - Modified brightness code to ramp up display on bootup to prevent spike LOADS from resetting ESP32 * - Modified main brightness code to ramp up and down all display brightness requests gradually, this will help with LOAD regulation especially on IV-9 clock * - Modified how the display is updated, moved away from directly calling WRITE_DISPLAY to updating digit variables directly * mainly to account for digit cross fading, added hardware timer at 1600hz, etc.. * - Upgraded ESP32 board manager from v2.0.6 to v2.0.8. Mainly to fix incorrect maximum sketch size bug https://github.com/espressif/arduino-esp32/issues/8026 * */