mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-22 21:14:50 +00:00
make a bootscreen
This commit is contained in:
parent
1a22a23c39
commit
0a369da4a2
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -40,6 +40,7 @@
|
|||||||
"cinttypes": "cpp",
|
"cinttypes": "cpp",
|
||||||
"utility": "cpp",
|
"utility": "cpp",
|
||||||
"typeinfo": "cpp",
|
"typeinfo": "cpp",
|
||||||
"string": "cpp"
|
"string": "cpp",
|
||||||
|
"*.xbm": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
6
TODO.md
6
TODO.md
@ -1,8 +1,9 @@
|
|||||||
# High priority
|
# High priority
|
||||||
|
|
||||||
* make nice screens (boot, about to sleep, debug info (gps signal, #people), latest text, person info - one frame per person on network)
|
* make nice screens (boot, about to sleep, debug info (gps signal, #people), latest text, person info - one frame per person on network)
|
||||||
|
* we are currently spinning like crazy in loop, instead sleep unless we have work to do
|
||||||
|
* have radiohead ISR send messages to RX queue directly, to allow that thread to block until we have something to send
|
||||||
* turn framerate from ui->state.frameState to 1 fps (or less) unless in transition
|
* turn framerate from ui->state.frameState to 1 fps (or less) unless in transition
|
||||||
* use a better font
|
|
||||||
* very occasionally send our position and user packet (if for nothing else so that other nodes update last_seen)
|
* very occasionally send our position and user packet (if for nothing else so that other nodes update last_seen)
|
||||||
* switch to my gui layout manager
|
* switch to my gui layout manager
|
||||||
* make basic gui. different screens: debug, one page for each user in the user db, last received text message
|
* make basic gui. different screens: debug, one page for each user in the user db, last received text message
|
||||||
@ -99,4 +100,5 @@ until the phone pulls those packets. Ever so often power on bluetooth just so w
|
|||||||
* correctly map nodeids to nodenums, currently we just do a proof of concept by always doing a broadcast
|
* correctly map nodeids to nodenums, currently we just do a proof of concept by always doing a broadcast
|
||||||
* add interrupt detach/sleep mode config to lora radio so we can enable deepsleep without panicing
|
* add interrupt detach/sleep mode config to lora radio so we can enable deepsleep without panicing
|
||||||
* make jtag work on second board
|
* make jtag work on second board
|
||||||
* implement regen owner and radio prefs
|
* implement regen owner and radio prefs
|
||||||
|
* use a better font
|
3
images/genfiles.sh
Executable file
3
images/genfiles.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
# using height of 50 to have 14 pixels beneath icon for text
|
||||||
|
inkscape -z -e icon.png -w 50 -h 50 icon-24px.svg
|
||||||
|
convert icon.png -background white -alpha Background ../src/icon.xbm
|
BIN
images/icon.png
Normal file
BIN
images/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
// Version
|
// Version
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define APP_NAME "meshtastic"
|
#define APP_NAME "Meshtastic"
|
||||||
#define APP_VERSION "0.0.1"
|
#define APP_VERSION "0.0.1"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
33
src/icon.xbm
Normal file
33
src/icon.xbm
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#define icon_width 50
|
||||||
|
#define icon_height 50
|
||||||
|
static const char icon_bits[] = {
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF,
|
||||||
|
0xFF, 0x07, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00,
|
||||||
|
0xF0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0x00,
|
||||||
|
0x00, 0x00, 0xFE, 0x0F, 0xC0, 0xFF, 0x01, 0x00, 0x00, 0xFF, 0x03, 0x00,
|
||||||
|
0xFF, 0x03, 0x00, 0x80, 0xFF, 0x00, 0x00, 0xFC, 0x07, 0x00, 0xC0, 0x3F,
|
||||||
|
0xE0, 0x1F, 0xF0, 0x0F, 0x00, 0xC0, 0x1F, 0xFC, 0xFF, 0xE0, 0x0F, 0x00,
|
||||||
|
0xE0, 0x0F, 0xFF, 0xFF, 0xC3, 0x1F, 0x00, 0xF0, 0x87, 0xFF, 0xFF, 0x87,
|
||||||
|
0x3F, 0x00, 0xF0, 0xC3, 0xFF, 0xFF, 0x0F, 0x3F, 0x00, 0xF8, 0xE3, 0x7F,
|
||||||
|
0xF8, 0x1F, 0x7F, 0x00, 0xF8, 0xF1, 0x0F, 0xC0, 0x3F, 0x7E, 0x00, 0xF8,
|
||||||
|
0xF1, 0x07, 0x80, 0x3F, 0x7E, 0x00, 0xFC, 0xF8, 0x03, 0x00, 0x7F, 0xFC,
|
||||||
|
0x00, 0xFC, 0xF8, 0x81, 0x07, 0x7E, 0xFC, 0x00, 0x7C, 0xF8, 0xE0, 0x1F,
|
||||||
|
0x7C, 0xF8, 0x00, 0x7C, 0xFC, 0xF0, 0x3F, 0xFC, 0xF8, 0x00, 0x7C, 0xFC,
|
||||||
|
0xF0, 0x3F, 0xFC, 0xF8, 0x00, 0x7C, 0x7C, 0xF8, 0x7F, 0xF8, 0xF8, 0x00,
|
||||||
|
0x7C, 0x7C, 0xF8, 0x7F, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0xF8, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
|
||||||
|
0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0xC0, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8,
|
||||||
|
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0xFE, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0x03, 0x00,
|
||||||
|
0x00, 0x00, 0x80, 0x7F, 0xF8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF0,
|
||||||
|
0x03, 0x00, 0x00, 0x00, 0x00, 0x1E, 0xE0, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, };
|
30
src/images.h
30
src/images.h
@ -7,35 +7,7 @@ const uint8_t SATELLITE_IMAGE[] PROGMEM = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#include "icon.xbm"
|
||||||
#define WiFi_Logo_width 60
|
|
||||||
#define WiFi_Logo_height 36
|
|
||||||
const uint8_t WiFi_Logo_bits[] PROGMEM = {
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF,
|
|
||||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
|
|
||||||
0xFF, 0x03, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
|
|
||||||
0x00, 0xFF, 0xFF, 0xFF, 0x07, 0xC0, 0x83, 0x01, 0x80, 0xFF, 0xFF, 0xFF,
|
|
||||||
0x01, 0x00, 0x07, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x0C, 0x00,
|
|
||||||
0xC0, 0xFF, 0xFF, 0x7C, 0x00, 0x60, 0x0C, 0x00, 0xC0, 0x31, 0x46, 0x7C,
|
|
||||||
0xFC, 0x77, 0x08, 0x00, 0xE0, 0x23, 0xC6, 0x3C, 0xFC, 0x67, 0x18, 0x00,
|
|
||||||
0xE0, 0x23, 0xE4, 0x3F, 0x1C, 0x00, 0x18, 0x00, 0xE0, 0x23, 0x60, 0x3C,
|
|
||||||
0x1C, 0x70, 0x18, 0x00, 0xE0, 0x03, 0x60, 0x3C, 0x1C, 0x70, 0x18, 0x00,
|
|
||||||
0xE0, 0x07, 0x60, 0x3C, 0xFC, 0x73, 0x18, 0x00, 0xE0, 0x87, 0x70, 0x3C,
|
|
||||||
0xFC, 0x73, 0x18, 0x00, 0xE0, 0x87, 0x70, 0x3C, 0x1C, 0x70, 0x18, 0x00,
|
|
||||||
0xE0, 0x87, 0x70, 0x3C, 0x1C, 0x70, 0x18, 0x00, 0xE0, 0x8F, 0x71, 0x3C,
|
|
||||||
0x1C, 0x70, 0x18, 0x00, 0xC0, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x08, 0x00,
|
|
||||||
0xC0, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x0C, 0x00, 0x80, 0xFF, 0xFF, 0x1F,
|
|
||||||
0x00, 0x00, 0x06, 0x00, 0x80, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x07, 0x00,
|
|
||||||
0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0xF8, 0xFF, 0xFF,
|
|
||||||
0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x01, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF,
|
|
||||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
};
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
const uint8_t activeSymbol[] PROGMEM = {
|
const uint8_t activeSymbol[] PROGMEM = {
|
||||||
|
@ -29,7 +29,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "OLEDDisplayUi.h"
|
#include "OLEDDisplayUi.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
#define SCREEN_HEADER_HEIGHT 14
|
#define FONT_HEIGHT 14 // actually 13 for "ariel 10" but want a little extra space
|
||||||
|
|
||||||
|
#define SCREEN_WIDTH 128
|
||||||
|
#define SCREEN_HEIGHT 64
|
||||||
|
|
||||||
#ifdef I2C_SDA
|
#ifdef I2C_SDA
|
||||||
SSD1306Wire dispdev(SSD1306_ADDRESS, I2C_SDA, I2C_SCL);
|
SSD1306Wire dispdev(SSD1306_ADDRESS, I2C_SDA, I2C_SCL);
|
||||||
@ -38,10 +41,10 @@ SSD1306Wire dispdev(SSD1306_ADDRESS, 0, 0); // fake values to keep build happy,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool disp; // true if we are using display
|
bool disp; // true if we are using display
|
||||||
uint8_t _screen_line = SCREEN_HEADER_HEIGHT - 1;
|
|
||||||
|
|
||||||
OLEDDisplayUi ui(&dispdev);
|
OLEDDisplayUi ui(&dispdev);
|
||||||
|
|
||||||
|
|
||||||
void msOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
void msOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
||||||
{
|
{
|
||||||
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
display->setTextAlignment(TEXT_ALIGN_RIGHT);
|
||||||
@ -49,13 +52,19 @@ void msOverlay(OLEDDisplay *display, OLEDDisplayUiState *state)
|
|||||||
display->drawString(128, 0, String(millis()));
|
display->drawString(128, 0, String(millis()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawFrame1(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
void drawBootScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
// draw an xbm image.
|
// draw an xbm image.
|
||||||
// Please note that everything that should be transitioned
|
// Please note that everything that should be transitioned
|
||||||
// needs to be drawn relative to x and y
|
// needs to be drawn relative to x and y
|
||||||
|
|
||||||
display->drawXbm(x + 34, y + 14, WiFi_Logo_width, WiFi_Logo_height, WiFi_Logo_bits);
|
display->drawXbm(x + 32, y, icon_width, icon_height,(const uint8_t *) icon_bits);
|
||||||
|
|
||||||
|
display->setFont(ArialMT_Plain_10);
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
|
display->drawString(64 + x, SCREEN_HEIGHT - FONT_HEIGHT, APP_NAME " " APP_VERSION);
|
||||||
|
|
||||||
|
ui.disableIndicator();
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
void drawFrame2(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
@ -91,7 +100,8 @@ void drawFrame3(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int1
|
|||||||
display->drawString(128 + x, 33 + y, "Right aligned (128,33)");
|
display->drawString(128 + x, 33 + y, "Right aligned (128,33)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawFrame4(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
/// Draw the last text message we received
|
||||||
|
void drawLastTextFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
// Demo for drawStringMaxWidth:
|
// Demo for drawStringMaxWidth:
|
||||||
// with the third parameter you can define the width after which words will be wrapped.
|
// with the third parameter you can define the width after which words will be wrapped.
|
||||||
@ -107,14 +117,14 @@ void drawFrame5(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int1
|
|||||||
|
|
||||||
// This array keeps function pointers to all frames
|
// This array keeps function pointers to all frames
|
||||||
// frames are the single views that slide in
|
// frames are the single views that slide in
|
||||||
FrameCallback frames[] = {drawFrame1, drawFrame2, drawFrame3, drawFrame4, drawFrame5};
|
FrameCallback frames[] = {drawBootScreen, drawFrame2, drawFrame3, drawLastTextFrame, drawFrame5};
|
||||||
|
|
||||||
// how many frames are there?
|
// how many frames are there?
|
||||||
int frameCount = 5;
|
int frameCount = 5;
|
||||||
|
int overlaysCount = 1;
|
||||||
|
|
||||||
// Overlays are statically drawn on top of a frame eg. a clock
|
// Overlays are statically drawn on top of a frame eg. a clock
|
||||||
OverlayCallback overlays[] = {msOverlay};
|
OverlayCallback overlays[] = {msOverlay};
|
||||||
int overlaysCount = 1;
|
|
||||||
|
|
||||||
void _screen_header()
|
void _screen_header()
|
||||||
{
|
{
|
||||||
@ -190,11 +200,11 @@ void screen_print(const char *text)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
dispdev.print(text);
|
dispdev.print(text);
|
||||||
if (_screen_line + 8 > dispdev.getHeight())
|
/* if (_screen_line + 8 > dispdev.getHeight())
|
||||||
{
|
{
|
||||||
// scroll
|
// scroll
|
||||||
}
|
}
|
||||||
_screen_line += 8;
|
_screen_line += 8; */
|
||||||
screen_loop();
|
screen_loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +246,7 @@ void screen_setup()
|
|||||||
// Scroll buffer
|
// Scroll buffer
|
||||||
dispdev.setLogBuffer(5, 30);
|
dispdev.setLogBuffer(5, 30);
|
||||||
|
|
||||||
dispdev.flipScreenVertically();
|
// dispdev.flipScreenVertically(); // looks better without this on lora32
|
||||||
dispdev.setFont(Custom_ArialMT_Plain_10);
|
dispdev.setFont(Custom_ArialMT_Plain_10);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user