mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 18:31:37 +00:00
Merged
This commit is contained in:
commit
5317895a5e
@ -2,16 +2,6 @@
|
|||||||
|
|
||||||
You probably don't care about this section - skip to the next one.
|
You probably don't care about this section - skip to the next one.
|
||||||
|
|
||||||
- do device release (after testing BLE fixes) https://github.com/meshtastic/Meshtastic-device/pull/218#event-3475395948
|
|
||||||
- some channel names don't work - check for illegal symbols per forum report
|
|
||||||
- auto invalidate old BLE handles
|
|
||||||
- disable software update button after update finishes
|
|
||||||
- mention translations in main readme
|
|
||||||
- check BLE handle stability across sleep - stress test sleep/wake - btu_init_core calls gatt_init - which assigns handles global
|
|
||||||
- @feh123 Sony Xperia Z1 C6903 running Android 5.1.1
|
|
||||||
- first message sent is still doubled for some people
|
|
||||||
- Android frontend should refetch the android messages from backend service on Resume
|
|
||||||
- let users set arbitrary params in android
|
|
||||||
- implement first cut of router mode: preferentially handle flooding, and change sleep and GPS behaviors
|
- implement first cut of router mode: preferentially handle flooding, and change sleep and GPS behaviors
|
||||||
- NRF52 BLE support
|
- NRF52 BLE support
|
||||||
|
|
||||||
|
@ -73,7 +73,8 @@ static void drawBootScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int1
|
|||||||
if (*region && region[3] == '-') // Skip past 1.0- in the 1.0-EU865 string
|
if (*region && region[3] == '-') // Skip past 1.0- in the 1.0-EU865 string
|
||||||
region += 4;
|
region += 4;
|
||||||
char buf[16];
|
char buf[16];
|
||||||
snprintf(buf, sizeof(buf), "%s", xstr(APP_VERSION)); // Note: we don't bother printing region or now, it makes the string too long
|
snprintf(buf, sizeof(buf), "%s",
|
||||||
|
xstr(APP_VERSION)); // Note: we don't bother printing region or now, it makes the string too long
|
||||||
display->drawString(SCREEN_WIDTH - 20, 0, buf);
|
display->drawString(SCREEN_WIDTH - 20, 0, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +177,8 @@ static void drawColumns(OLEDDisplay *display, int16_t x, int16_t y, const char *
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Draw power bars or a charging indicator on an image of a battery, determined by battery charge voltage or percentage.
|
// Draw power bars or a charging indicator on an image of a battery, determined by battery charge voltage or percentage.
|
||||||
static void drawBattery(OLEDDisplay *display, int16_t x, int16_t y, uint8_t *imgBuffer, PowerStatusHandler *powerStatusHandler) {
|
static void drawBattery(OLEDDisplay *display, int16_t x, int16_t y, uint8_t *imgBuffer, PowerStatusHandler *powerStatusHandler)
|
||||||
|
{
|
||||||
static const uint8_t powerBar[3] = { 0x81, 0xBD, 0xBD };
|
static const uint8_t powerBar[3] = { 0x81, 0xBD, 0xBD };
|
||||||
static const uint8_t lightning[8] = { 0xA1, 0xA1, 0xA5, 0xAD, 0xB5, 0xA5, 0x85, 0x85 };
|
static const uint8_t lightning[8] = { 0xA1, 0xA1, 0xA5, 0xAD, 0xB5, 0xA5, 0x85, 0x85 };
|
||||||
// Clear the bar area on the battery image
|
// Clear the bar area on the battery image
|
||||||
@ -189,14 +191,16 @@ static void drawBattery(OLEDDisplay *display, int16_t x, int16_t y, uint8_t *img
|
|||||||
// If not charging, Draw power bars
|
// If not charging, Draw power bars
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
if(powerStatusHandler->getBatteryChargePercent() >= 25 * i) memcpy(imgBuffer + 1 + (i * 3), powerBar, 3);
|
if(powerStatusHandler->getBatteryChargePercent() >= 25 * i)
|
||||||
|
memcpy(imgBuffer + 1 + (i * 3), powerBar, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
display->drawFastImage(x, y, 16, 8, imgBuffer);
|
display->drawFastImage(x, y, 16, 8, imgBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw nodes status
|
// Draw nodes status
|
||||||
static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, NodeStatusHandler *nodeStatusHandler) {
|
static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, NodeStatusHandler *nodeStatusHandler)
|
||||||
|
{
|
||||||
char usersString[20];
|
char usersString[20];
|
||||||
sprintf(usersString, "%d/%d", nodeStatusHandler->getNumOnline(), nodeStatusHandler->getNumTotal());
|
sprintf(usersString, "%d/%d", nodeStatusHandler->getNumOnline(), nodeStatusHandler->getNumTotal());
|
||||||
display->drawFastImage(x, y, 8, 8, imgUser);
|
display->drawFastImage(x, y, 8, 8, imgUser);
|
||||||
@ -204,16 +208,41 @@ static void drawNodes(OLEDDisplay *display, int16_t x, int16_t y, NodeStatusHand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw GPS status summary
|
// Draw GPS status summary
|
||||||
static void drawGPS(OLEDDisplay *display, int16_t x, int16_t y, GPSStatusHandler *gpsStatusHandler) {
|
static void drawGPS(OLEDDisplay *display, int16_t x, int16_t y, GPSStatusHandler *gps)
|
||||||
if(!gpsStatusHandler->isConnected()) { display->drawString(x, y - 2, "No GPS"); return; }
|
{
|
||||||
|
if (!gps->isConnected()) {
|
||||||
|
display->drawString(x, y - 2, "No GPS");
|
||||||
|
return;
|
||||||
|
}
|
||||||
display->drawFastImage(x, y, 6, 8, gps->hasLock() ? imgPositionSolid : imgPositionEmpty);
|
display->drawFastImage(x, y, 6, 8, gps->hasLock() ? imgPositionSolid : imgPositionEmpty);
|
||||||
if(!gpsStatusHandler->hasLock()) { display->drawString(x + 8, y - 2, "No sats"); return; }
|
if (!gps->hasLock()) {
|
||||||
if(gpsStatusHandler->getDOP() <= 100) { display->drawString(x + 8, y - 2, "Ideal"); return; }
|
display->drawString(x + 8, y - 2, "No sats");
|
||||||
if(gpsStatusHandler->getDOP() <= 200) { display->drawString(x + 8, y - 2, "Exc."); return; }
|
return;
|
||||||
if(gpsStatusHandler->getDOP() <= 500) { display->drawString(x + 8, y - 2, "Good"); return; }
|
}
|
||||||
if(gpsStatusHandler->getDOP() <= 1000) { display->drawString(x + 8, y - 2, "Mod."); return; }
|
if (gps->getDOP() <= 100) {
|
||||||
if(gpsStatusHandler->getDOP() <= 2000) { display->drawString(x + 8, y - 2, "Fair"); return; }
|
display->drawString(x + 8, y - 2, "Ideal");
|
||||||
if(gpsStatusHandler->getDOP() > 0) { display->drawString(x + 8, y - 2, "Poor"); return; }
|
return;
|
||||||
|
}
|
||||||
|
if (gps->getDOP() <= 200) {
|
||||||
|
display->drawString(x + 8, y - 2, "Exc.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (gps->getDOP() <= 500) {
|
||||||
|
display->drawString(x + 8, y - 2, "Good");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (gps->getDOP() <= 1000) {
|
||||||
|
display->drawString(x + 8, y - 2, "Mod.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (gps->getDOP() <= 2000) {
|
||||||
|
display->drawString(x + 8, y - 2, "Fair");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (gps->getDOP() > 0) {
|
||||||
|
display->drawString(x + 8, y - 2, "Poor");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ported from my old java code, returns distance in meters along the globe
|
/// Ported from my old java code, returns distance in meters along the globe
|
||||||
@ -424,11 +453,10 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
snprintf(lastStr, sizeof(lastStr), "%u hours ago", agoSecs / 60 / 60);
|
snprintf(lastStr, sizeof(lastStr), "%u hours ago", agoSecs / 60 / 60);
|
||||||
|
|
||||||
static char distStr[20];
|
static char distStr[20];
|
||||||
*distStr = 0; // might not have location data
|
strcpy(distStr, "? km"); // might not have location data
|
||||||
float headingRadian;
|
float headingRadian;
|
||||||
NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum());
|
NodeInfo *ourNode = nodeDB.getNode(nodeDB.getNodeNum());
|
||||||
const char *fields[] = {username, distStr, signalStr, lastStr, NULL};
|
const char *fields[] = {username, distStr, signalStr, lastStr, NULL};
|
||||||
drawColumns(display, x, y, fields);
|
|
||||||
|
|
||||||
// coordinates for the center of the compass/circle
|
// coordinates for the center of the compass/circle
|
||||||
int16_t compassX = x + SCREEN_WIDTH - COMPASS_DIAM / 2 - 1, compassY = y + SCREEN_HEIGHT / 2;
|
int16_t compassX = x + SCREEN_WIDTH - COMPASS_DIAM / 2 - 1, compassY = y + SCREEN_HEIGHT / 2;
|
||||||
@ -454,6 +482,9 @@ static void drawNodeInfo(OLEDDisplay *display, OLEDDisplayUiState *state, int16_
|
|||||||
display->drawString(compassX - FONT_HEIGHT / 4, compassY - FONT_HEIGHT / 2, "?");
|
display->drawString(compassX - FONT_HEIGHT / 4, compassY - FONT_HEIGHT / 2, "?");
|
||||||
display->drawCircle(compassX, compassY, COMPASS_DIAM / 2);
|
display->drawCircle(compassX, compassY, COMPASS_DIAM / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Must be after distStr is populated
|
||||||
|
drawColumns(display, x, y, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -720,7 +751,10 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
snprintf(channelStr, sizeof(channelStr), "#%s", channelName.c_str());
|
snprintf(channelStr, sizeof(channelStr), "#%s", channelName.c_str());
|
||||||
|
|
||||||
// Display power status
|
// Display power status
|
||||||
if (powerStatusHandler->hasBattery()) drawBattery(display, x, y + 2, imgBattery, powerStatusHandler); else display->drawFastImage(x, y + 2, 16, 8, powerStatusHandler->hasUSB() ? imgUSB : imgPower);
|
if (powerStatusHandler->hasBattery())
|
||||||
|
drawBattery(display, x, y + 2, imgBattery, powerStatusHandler);
|
||||||
|
else
|
||||||
|
display->drawFastImage(x, y + 2, 16, 8, powerStatusHandler->hasUSB() ? imgUSB : imgPower);
|
||||||
// Display nodes status
|
// Display nodes status
|
||||||
drawNodes(display, x + (SCREEN_WIDTH * 0.25), y + 2, nodeStatusHandler);
|
drawNodes(display, x + (SCREEN_WIDTH * 0.25), y + 2, nodeStatusHandler);
|
||||||
// Display GPS status
|
// Display GPS status
|
||||||
@ -736,9 +770,9 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
}
|
}
|
||||||
|
|
||||||
// adjust Brightness cycle trough 1 to 254 as long as attachDuringLongPress is true
|
// adjust Brightness cycle trough 1 to 254 as long as attachDuringLongPress is true
|
||||||
void Screen::adjustBrightness(){
|
void Screen::adjustBrightness()
|
||||||
if (brightness == 254)
|
|
||||||
{
|
{
|
||||||
|
if (brightness == 254) {
|
||||||
brightness = 0;
|
brightness = 0;
|
||||||
} else {
|
} else {
|
||||||
brightness++;
|
brightness++;
|
||||||
|
Loading…
Reference in New Issue
Block a user