diff --git a/MyConfig.h b/MyConfig.h index 4260682..852472a 100644 --- a/MyConfig.h +++ b/MyConfig.h @@ -1,4 +1,4 @@ -/* +/* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each @@ -62,6 +62,12 @@ */ //#define MY_CORE_ONLY +/** +* @def MY_SPLASH_SCREEN_DISABLED +* @brief Set MY_SPLASH_SCREEN_DISABLED to disable MySensors splash screen. (This saves 120 bytes of flash) +*/ +//#define MY_DISABLED_SERIAL + // Turn off debug if serial pins is used for other stuff #ifdef MY_DISABLED_SERIAL #undef MY_DEBUG @@ -1341,6 +1347,7 @@ #define MY_WITH_LEDS_BLINKING_INVERSE #define MY_INDICATION_HANDLER #define MY_DISABLE_REMOTE_RESET +#define MY_SPLASH_SCREEN_DISABLED // signing #define MY_SIGNING_SIMPLE_PASSWD #define MY_SIGNING_ATSHA204 diff --git a/MySensors.h b/MySensors.h index 8678022..53737f8 100644 --- a/MySensors.h +++ b/MySensors.h @@ -1,4 +1,4 @@ -/* +/* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each @@ -30,6 +30,7 @@ #endif #include "MyConfig.h" +#include "core/MySplashScreen.h" #include "core/MySensorsCore.h" // Detect node type @@ -426,6 +427,7 @@ MY_DEFAULT_RX_LED_PIN in your sketch instead to enable LEDs #include "core/MyCapabilities.h" #include "core/MyMessage.cpp" +#include "core/MySplashScreen.cpp" #include "core/MySensorsCore.cpp" // HW mains diff --git a/core/MySensorsCore.cpp b/core/MySensorsCore.cpp index a126c4a..dbfe85a 100644 --- a/core/MySensorsCore.cpp +++ b/core/MySensorsCore.cpp @@ -1,4 +1,4 @@ -/* +/* * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each @@ -96,15 +96,20 @@ void _begin(void) preHwInit(); } - if (!hwInit()) { + const bool hwInitResult = hwInit(); + +#if !defined(MY_SPLASH_SCREEN_DISABLED) + displaySplashScreen(); +#endif + + CORE_DEBUG(PSTR("MCO:BGN:INIT CP=" MY_CAPABILITIES "\n")); + + if (!hwInitResult) { CORE_DEBUG(PSTR("!MCO:BGN:HW ERR\n")); setIndication(INDICATION_ERR_HW_INIT); _infiniteLoop(); } - CORE_DEBUG(PSTR("MCO:BGN:INIT " MY_NODE_TYPE ",CP=" MY_CAPABILITIES ",VER=" - MYSENSORS_LIBRARY_VERSION "\n")); - // set defaults _coreConfig.presentationSent = false; diff --git a/core/MySplashScreen.cpp b/core/MySplashScreen.cpp new file mode 100644 index 0000000..031daa0 --- /dev/null +++ b/core/MySplashScreen.cpp @@ -0,0 +1,52 @@ +/* +* The MySensors Arduino library handles the wireless radio link and protocol +* between your home built sensors/actuators and HA controller of choice. +* The sensors forms a self healing radio network with optional repeaters. Each +* repeater and gateway builds a routing tables in EEPROM which keeps track of the +* network topology allowing messages to be routed to nodes. +* +* Created by Henrik Ekblad +* Copyright (C) 2013-2017 Sensnology AB +* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors +* +* Documentation: http://www.mysensors.org +* Support Forum: http://forum.mysensors.org +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +*/ + +#include "MySensorsCore.h" + +void displaySplashScreen(void) +{ +#if !defined(MY_DISABLED_SERIAL) + static const uint8_t splashScreen[] PROGMEM = { + 0x20, 0x7C, 0x5F, 0x5c, 0x2F, 0x60, 0x2C, 0x0A, // substitution matrix + 0x02, 0x20, 0x02, 0x20, 0xB2, 0x87, 0x10, 0x03, 0x40, 0x01, 0x20, 0x00, 0x24, 0x02, 0x22, 0x10, + 0x02, 0x22, 0x02, 0x02, 0x20, 0x02, 0x22, 0x00, 0x22, 0x20, 0x02, 0x02, 0x20, 0x22, 0x27, 0x10, + 0x13, 0x41, 0x01, 0x01, 0x01, 0x03, 0x22, 0x20, 0x30, 0x40, 0x20, 0x30, 0x52, 0x03, 0x40, 0x22, + 0x14, 0x02, 0x03, 0x10, 0x52, 0x24, 0x02, 0x21, 0x71, 0x01, 0x00, 0x10, 0x10, 0x12, 0x10, 0x12, + 0x22, 0x10, 0x10, 0x02, 0x24, 0x01, 0x01, 0x03, 0x22, 0x03, 0x00, 0x20, 0x01, 0x01, 0x00, 0x32, + 0x20, 0x37, 0x12, 0x10, 0x01, 0x21, 0x32, 0x26, 0x01, 0x28, 0x40, 0x32, 0x22, 0x12, 0x10, 0x12, + 0x12, 0x22, 0x43, 0x22, 0x24, 0x12, 0x10, 0x01, 0x22, 0x24, 0x70, 0xC1, 0x22, 0x24, 0x0F, 0x0F + }; + uint8_t pos = 16; + char display = 0; + while (pos>1])); + val = (pos % 2) ? val & 0xF : val >> 4; + pos++; + if (val<8) { + display = pgm_read_byte(&(splashScreen[val])); + } + const uint8_t rep = val > 7 ? val - 5 : 1; + for (uint8_t c = 0; c +* Copyright (C) 2013-2017 Sensnology AB +* Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors +* +* Documentation: http://www.mysensors.org +* Support Forum: http://forum.mysensors.org +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* version 2 as published by the Free Software Foundation. +*/ + +#ifndef MySplashScreen_h +#define MySplashScreen_h + +/** +* Display MySensors splash screen. +*/ +void displaySplashScreen(void); + +#endif \ No newline at end of file