From 70eda2ee063a1437ac78a3da0470f882d4ec1f46 Mon Sep 17 00:00:00 2001 From: Jason Fish Date: Sun, 26 Jul 2020 08:39:37 -0700 Subject: [PATCH 1/3] Adding new case URL to Readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c4f844c56..d4ede0040 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ We currently support three models of radios. - 3D printable cases - [T-Beam V0](https://www.thingiverse.com/thing:3773717) - [T-Beam V1](https://www.thingiverse.com/thing:3830711) + - Laser-cut cases + - [T-Beam V1](https://www.thingiverse.com/thing:4552771) - [TTGO LORA32](https://www.aliexpress.com/item/4000211331316.html) - No GPS - version 2.1 From d191b12801b3ef8a818112a6712dce997cf438e9 Mon Sep 17 00:00:00 2001 From: Todd Allen Date: Mon, 27 Jul 2020 09:14:04 -0400 Subject: [PATCH 2/3] Adding port/help flags and error checking --- bin/device-install.sh | 48 ++++++++++++++++++++++++++++++++++++------- bin/device-update.sh | 45 +++++++++++++++++++++++++++++++++++----- 2 files changed, 81 insertions(+), 12 deletions(-) diff --git a/bin/device-install.sh b/bin/device-install.sh index 1101e26b1..fb374d091 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -1,11 +1,45 @@ -#!/bin/bash +#!/bin/sh -set -e +# Usage info +show_help() { +cat << EOF +Usage: ${0##*/} [-h] [-p ESPTOOL_PORT] [-f FILENAME] +Flash image file to device, but first erasing and writing system information" -FILENAME=$1 + -h Display this help and exit + -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous). + -f FILENAME The .bin file to flash. Custom to your device type and region. +EOF +} -echo "Trying to flash $FILENAME, but first erasing and writing system information" -esptool.py --baud 921600 erase_flash -esptool.py --baud 921600 write_flash 0x1000 system-info.bin -esptool.py --baud 921600 write_flash 0x10000 $FILENAME +while getopts ":h:p:f:" opt; do + case "${opt}" in + h) + show_help + exit 0 + ;; + p) export ESPTOOL_PORT=${OPTARG} + ;; + f) FILENAME=${OPTARG} + ;; + *) + echo "Invalid flag." + show_help >&2 + exit 1 + ;; + esac +done +shift "$((OPTIND-1))" + +if [ -f "${FILENAME}" ]; then + echo "Trying to flash ${FILENAME}, but first erasing and writing system information" + esptool.py --baud 921600 erase_flash + esptool.py --baud 921600 write_flash 0x1000 system-info.bin + esptool.py --baud 921600 write_flash 0x10000 ${FILENAME} +else + echo "Invalid file: ${FILENAME}" + show_help +fi + +exit 0 diff --git a/bin/device-update.sh b/bin/device-update.sh index ecfee105a..4125ade6a 100755 --- a/bin/device-update.sh +++ b/bin/device-update.sh @@ -1,8 +1,43 @@ -#!/bin/bash +#!/bin/sh -set -e +# Usage info +show_help() { +cat << EOF +Usage: ${0##*/} [-h] [-p ESPTOOL_PORT] -f FILENAME +Flash image file to device, leave existing system intact." -FILENAME=$1 + -h Display this help and exit + -p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous). + -f FILENAME The .bin file to flash. Custom to your device type and region. +EOF +} -echo "Trying to update $FILENAME" -esptool.py --baud 921600 write_flash 0x10000 $FILENAME + +while getopts ":h:p:f:" opt; do + case "${opt}" in + h) + show_help + exit 0 + ;; + p) export ESPTOOL_PORT=${OPTARG} + ;; + f) FILENAME=${OPTARG} + ;; + *) + echo "Invalid flag." + show_help >&2 + exit 1 + ;; + esac +done +shift "$((OPTIND-1))" + +if [ -f "${FILENAME}" ]; then + echo "Trying to flash update ${FILENAME}." + esptool.py --baud 921600 write_flash 0x10000 ${FILENAME} +else + echo "Invalid file: ${FILENAME}" + show_help +fi + +exit 0 From 7f45184d90d42568a5d724690036d3b44e543396 Mon Sep 17 00:00:00 2001 From: Ellie Hussey Date: Sat, 1 Aug 2020 10:50:06 -0700 Subject: [PATCH 3/3] Fixed message text wrapping, compass rose position, and added device ID on status page (#300) --- src/graphics/Screen.cpp | 20 +++++++++++++++++--- src/graphics/images.h | 8 +++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 23e4d32ae..25576fb6a 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -43,11 +43,15 @@ static FrameCallback normalFrames[MAX_NUM_NODES + NUM_EXTRA_FRAMES]; static uint32_t targetFramerate = IDLE_FRAMERATE; static char btPIN[16] = "888888"; +// This image definition is here instead of images.h because it's modified dynamically by the drawBattery function uint8_t imgBattery[16] = { 0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xE7, 0x3C }; -uint8_t imgSatellite[8] = { 0x70, 0x71, 0x22, 0xFA, 0xFA, 0x22, 0x71, 0x70 }; +// Threshold values for the GPS lock accuracy bar display uint32_t dopThresholds[5] = { 2000, 1000, 500, 200, 100 }; +// Stores the last 4 of our hardware ID, to make finding the device for pairing easier +static char ourId[5]; + #ifdef SHOW_REDRAWS static bool heartbeat = false; #endif @@ -116,7 +120,7 @@ static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state assert(mp.decoded.which_payload == SubPacket_data_tag); snprintf(tempBuf, sizeof(tempBuf), " %s", mp.decoded.data.payload.bytes); - display->drawStringMaxWidth(4 + x, 10 + y, 128, tempBuf); + display->drawStringMaxWidth(4 + x, 10 + y, SCREEN_WIDTH - (6 + x), tempBuf); } /// Draw a series of fields in a column, wrapping to multiple colums if needed @@ -408,7 +412,7 @@ static void drawCompassHeading(OLEDDisplay *display, int16_t compassX, int16_t c for (int i = 0; i < 4; i++) { rosePoints[i]->rotate(myHeading); - rosePoints[i]->scale(COMPASS_DIAM); + rosePoints[i]->scale(-1 * COMPASS_DIAM); rosePoints[i]->translate(compassX, compassY); } drawLine(display, N1, N3); @@ -594,6 +598,11 @@ void Screen::setup() dispdev.flipScreenVertically(); #endif + // Get our hardware ID + uint8_t dmac[6]; + getMacAddr(dmac); + sprintf(ourId, "%02x%02x", dmac[4], dmac[5]); + // Turn on the display. handleSetOn(true); @@ -783,8 +792,13 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 drawGPS(display, x + (SCREEN_WIDTH * 0.63), y + 2, gpsStatus); } + // Draw the channel name display->drawString(x, y + FONT_HEIGHT, channelStr); + // Draw our hardware ID to assist with bluetooth pairing + display->drawFastImage(x + SCREEN_WIDTH - (10) - display->getStringWidth(ourId), y + 2 + FONT_HEIGHT, 8, 8, imgInfo); + display->drawString(x + SCREEN_WIDTH - display->getStringWidth(ourId), y + FONT_HEIGHT, ourId); + // Draw any log messages display->drawLogBuffer(x, y + (FONT_HEIGHT * 2)); /* Display a heartbeat pixel that blinks every time the frame is redrawn */ diff --git a/src/graphics/images.h b/src/graphics/images.h index 960d38d13..41b390eaf 100644 --- a/src/graphics/images.h +++ b/src/graphics/images.h @@ -6,11 +6,13 @@ const uint8_t SATELLITE_IMAGE[] PROGMEM = {0x00, 0x08, 0x00, 0x1C, 0x00, 0x0E, 0 0xF8, 0x00, 0xF0, 0x01, 0xE0, 0x03, 0xC8, 0x01, 0x9C, 0x54, 0x0E, 0x52, 0x07, 0x48, 0x02, 0x26, 0x00, 0x10, 0x00, 0x0E}; +const uint8_t imgSatellite[] PROGMEM = { 0x70, 0x71, 0x22, 0xFA, 0xFA, 0x22, 0x71, 0x70 }; const uint8_t imgUSB[] PROGMEM = { 0x60, 0x60, 0x30, 0x18, 0x18, 0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x7E, 0x24, 0x24, 0x24, 0x3C }; const uint8_t imgPower[] PROGMEM = { 0x40, 0x40, 0x40, 0x58, 0x48, 0x08, 0x08, 0x08, 0x1C, 0x22, 0x22, 0x41, 0x7F, 0x22, 0x22, 0x22 }; -const uint8_t imgUser[] PROGMEM = { 0x3C, 0x42, 0x99, 0xA5, 0xA5, 0x99, 0x42, 0x3C }; -const uint8_t imgPositionEmpty[] PROGMEM = { 0x20, 0x30, 0x28, 0x24, 0x42, 0xFF }; -const uint8_t imgPositionSolid[] PROGMEM = { 0x20, 0x30, 0x38, 0x3C, 0x7E, 0xFF }; +const uint8_t imgUser[] PROGMEM = { 0x3C, 0x42, 0x99, 0xA5, 0xA5, 0x99, 0x42, 0x3C }; +const uint8_t imgPositionEmpty[] PROGMEM = { 0x20, 0x30, 0x28, 0x24, 0x42, 0xFF }; +const uint8_t imgPositionSolid[] PROGMEM = { 0x20, 0x30, 0x38, 0x3C, 0x7E, 0xFF }; +const uint8_t imgInfo[] PROGMEM = { 0xFF, 0x81, 0x81, 0xB5, 0xB5, 0x81, 0x81, 0xFF }; #include "img/icon.xbm"