MySensors splash screen (#889)

This commit is contained in:
Olivier
2017-07-24 21:42:44 +02:00
committed by Henrik Ekblad
parent 90793e734c
commit 10ef62307b
5 changed files with 101 additions and 7 deletions
+8 -1
View File
@@ -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
+3 -1
View File
@@ -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
+10 -5
View File
@@ -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;
+52
View File
@@ -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 <henrik.ekblad@mysensors.org>
* 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<sizeof(splashScreen)*2) {
uint8_t val = pgm_read_byte(&(splashScreen[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<rep; c++) {
MY_SERIALDEVICE.print(display);
}
}
MY_SERIALDEVICE.println(F(MYSENSORS_LIBRARY_VERSION));
MY_SERIALDEVICE.println();
#endif
}
+28
View File
@@ -0,0 +1,28 @@
/*
* 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 <henrik.ekblad@mysensors.org>
* 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