3djc/rssi poweroff safety (#5126)

Shutdown RSSI Alert
This commit is contained in:
Bertrand Songis
2017-08-01 14:13:25 +02:00
committed by GitHub
parent a7524ba74d
commit 7434e330c8
35 changed files with 1033 additions and 893 deletions
+6 -3
View File
@@ -293,7 +293,7 @@ void lcdDrawChar(coord_t x, coord_t y, const unsigned char c)
uint8_t getTextWidth(const char * s, uint8_t len, LcdFlags flags)
{
uint8_t width = 0;
while (len--) {
for (int i=0; len==0 || i<len; ++i) {
unsigned char c = (flags & ZCHAR) ? idx2char(*s) : *s;
if (!c) {
break;
@@ -1563,15 +1563,18 @@ void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlag
}
#if defined(PWR_PRESS_BUTTON)
void drawShutdownAnimation(uint32_t index)
void drawShutdownAnimation(uint32_t index, const char * message)
{
lcdClear();
int quarter = index / (PWR_PRESS_SHUTDOWN_DELAY / 5);
for (int i=1; i<=4; i++) {
if ((4 -quarter) >= i) {
if (4 - quarter >= i) {
lcdDrawFilledRect(LCD_W / 2 - 28 + 10 * i, LCD_H / 2 - 3, 6, 6, SOLID, 0);
}
}
if (message) {
lcdDrawText((LCD_W - getTextWidth(message)) / 2, LCD_H-2*FH, message);
}
lcdRefresh();
}
#endif