diff --git a/src/audio_arm.cpp b/src/audio_arm.cpp index 5a9ab0885..34c2dfadc 100644 --- a/src/audio_arm.cpp +++ b/src/audio_arm.cpp @@ -636,7 +636,7 @@ void AudioQueue::playFile(const char *filename, uint8_t flags, uint8_t id) if (flags & PLAY_BACKGROUND) { memset(&backgroundContext.fragment, 0, sizeof(AudioFragment)); - strncpy(backgroundContext.fragment.file, filename, 32); + strcpy(backgroundContext.fragment.file, filename); backgroundContext.fragment.id = id; if (!busy()) { state = AUDIO_RESUMING; @@ -648,7 +648,7 @@ void AudioQueue::playFile(const char *filename, uint8_t flags, uint8_t id) if (next_widx != ridx) { AudioFragment & fragment = fragments[widx]; memset(&fragment, 0, sizeof(fragment)); - strcpy(fragment.file, filename); // TODO strncpy + strcpy(fragment.file, filename); fragment.repeat = flags & 0x0f; fragment.id = id; if (flags & PLAY_NOW) diff --git a/src/icons.lbm b/src/icons.lbm index c259a31de..6f2afd395 100644 --- a/src/icons.lbm +++ b/src/icons.lbm @@ -1,2 +1,2 @@ -49,8, -0x1d,0xe3,0xe3,0x1c,0x1c,0xdd,0xdd,0x3e,0xea,0x23,0x6b,0xb6,0xa1,0x9f,0xbf,0xc0,0xf9,0xef,0xff,0xe8,0xa1,0x9f,0xbf,0xc0,0xea,0x23,0x6b,0xb6,0x1c,0xdd,0xdd,0x3e,0x1d,0xe3,0xe3,0x1c,0x39,0xff,0xff,0x38,0x39,0xbb,0xbb,0x7c,0x7c,0x7d,0x7d,0xfe,0xfe,0xff,0xff,0xfe,0x29,0xd7,0xff,0x00,0x29,0xef,0xef,0x38,0xfe,0x93,0xff,0x92,0x7c,0x45,0x7d,0xc6,0x39,0xbb,0xbb,0x7c,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0xff,0x41,0x41,0x41,0xff,0x7d,0x7d,0x7d,0xff,0x7d,0x7d,0x7d,0xff,0x7d,0x7d,0x7d,0xff,0x7d,0x7d,0x7d,0xfd,0x7b,0x7b,0x79,0xfb,0x47,0x47,0x43,0xff,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0xff,0x7f,0x7f,0x7f,0xe3,0x7f,0x77,0x63,0xdd,0x7f,0x63,0x41,0xdd,0x7f,0x41,0x41,0xdd,0x7f,0x63,0x41,0xe3,0x7f,0x77,0x63,0xff,0x7f,0x7f,0x7f,0xff,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0x7f,0xfb,0x47,0x47,0x43,0xff,0x7b,0x7b,0x7b,0xdb,0x67,0x67,0x43,0xff,0x5f,0x5f,0x5f,0xff,0x59,0x59,0x59,0xdd,0x67,0x63,0x41,0xff,0x79,0x79,0x79,0xff,0x7f,0x7f,0x7f,0xff,0xff,0xff,0xff, +102,8, +0x1d,0xe3,0xe3,0x1c,0x1c,0xdd,0xdd,0x3e,0xea,0x23,0x6b,0xb6,0xa1,0x9f,0xbf,0xc0,0xf9,0xef,0xff,0xe8,0xa1,0x9f,0xbf,0xc0,0xea,0x23,0x6b,0xb6,0x1c,0xdd,0xdd,0x3e,0x1d,0xe3,0xe3,0x1c,0x38,0xff,0xff,0x38,0x7c,0xbb,0xbb,0x7c,0xfe,0x7d,0x7d,0xfe,0xfe,0xff,0xff,0xfe,0x00,0xff,0xff,0x00,0x50,0xff,0xff,0x50,0x20,0xff,0xff,0x20,0x50,0xff,0xff,0x50,0x38,0xff,0xff,0x38,0x7c,0xbb,0xbb,0x7c,0xfe,0x7d,0x7d,0xfe,0xfe,0xff,0xff,0xfe,0x00,0xff,0xff,0x00,0x40,0xff,0xff,0x40,0x40,0xff,0xff,0x40,0x40,0xff,0xff,0x40,0x38,0xff,0xff,0x38,0x7c,0xbb,0xbb,0x7c,0xfe,0x7d,0x7d,0xfe,0xfe,0xff,0xff,0xfe,0x00,0xff,0xff,0x00,0x50,0xff,0xff,0x50,0x50,0xff,0xff,0x50,0x50,0xff,0xff,0x50,0x38,0xff,0xff,0x38,0x7c,0xbb,0xbb,0x7c,0xfe,0x7d,0x7d,0xfe,0xfe,0xff,0xff,0xfe,0x00,0xff,0xff,0x00,0x54,0xff,0xff,0x54,0x54,0xff,0xff,0x54,0x54,0xff,0xff,0x54,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0xff,0xc1,0x41,0x41,0xff,0xfd,0x7d,0x7d,0xff,0xfd,0x7d,0x7d,0xff,0xfd,0x7d,0x7d,0xff,0xfd,0x7d,0x7d,0xfd,0xfb,0x7b,0x79,0xfb,0xc7,0x47,0x43,0xff,0xff,0x7f,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0xff,0xff,0x7f,0x7f,0xe3,0xff,0x77,0x63,0xdd,0xff,0x63,0x41,0xdd,0xff,0x41,0x41,0xdd,0xff,0x63,0x41,0xe3,0xff,0x77,0x63,0xff,0xff,0x7f,0x7f,0xff,0xff,0x7f,0x7f,0xff,0xff,0xff,0xff,0xfd,0xff,0x43,0x41,0xff,0xff,0x7d,0x7d,0xff,0xff,0x73,0x73,0xff,0xff,0x7d,0x7d,0xdd,0xff,0x63,0x41,0xff,0xff,0x5f,0x5f,0xff,0xff,0x59,0x59,0xdd,0xff,0x63,0x41,0xff,0xff,0x79,0x79,0xff,0xff,0xff,0xff,0xff,0xff,0x79,0x79,0xdd,0xff,0x63,0x41,0xff,0xff,0x59,0x59,0xff,0xff,0x5f,0x5f,0xf5,0xff,0x5b,0x51,0xff,0xff,0x55,0x55,0xff,0xff,0x55,0x55,0xff,0xff,0x55,0x55,0xd7,0xff,0x6d,0x45,0xff,0xff,0xff,0xff,0xff,0xff,0x63,0x63,0xff,0xff,0x63,0x63,0xff,0xff,0x77,0x77,0xff,0xff,0x73,0x73,0xff,0xff,0x65,0x65,0xfd,0xff,0x57,0x55,0xff,0xff,0x77,0x77,0xff,0xff,0x63,0x63,0xeb,0xff,0x77,0x63,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x7f,0xff,0xff,0x7f,0x7f,0xff,0xff,0x7f,0x7f,0xff,0xff,0x7f,0x7f,0xff,0xff,0x51,0x51,0xff,0xff,0x7f,0x7f,0xff,0xff,0x7f,0x7f,0xff,0xff,0x7f,0x7f,0xff,0xff,0x7f,0x7f,0xff,0xff,0xff,0xff, diff --git a/src/icons.png b/src/icons.png index ac417ca23..d1b125a47 100644 Binary files a/src/icons.png and b/src/icons.png differ diff --git a/src/main_views.cpp b/src/main_views.cpp index 84990e780..0c65cb6b1 100644 --- a/src/main_views.cpp +++ b/src/main_views.cpp @@ -105,11 +105,17 @@ #include "icons.lbm" }; - #define ICON_RSSI 0, 9 - #define ICON_SPEAKER 9, 9 - #define ICON_SD 18, 11 - #define ICON_LOGS 28, 11 - #define ICON_TRAINER 38, 11 + #define ICON_RSSI 0, 9 + #define ICON_SPEAKER0 9, 8 + #define ICON_SPEAKER1 17, 8 + #define ICON_SPEAKER2 25, 8 + #define ICON_SPEAKER3 33, 8 + #define ICON_SD 41, 11 + #define ICON_LOGS 51, 11 + #define ICON_TRAINER 61, 11 + #define ICON_TRAINEE 71, 11 + #define ICON_USB 81, 11 + #define ICON_REBOOT 91, 11 #endif void drawPotsBars() @@ -200,15 +206,15 @@ void displaySliders() } } -#define BAR_X 15 +#define BAR_X 14 #define BAR_Y 1 -#define BAR_BATT_X BAR_X+19 +#define BAR_W 184 +#define BAR_H 9 +#define BAR_BATT_X BAR_X+18 #define BAR_RSSI_X BAR_X+42 -#define BAR_SD_X BAR_X+100 -#define BAR_LOGS_X BAR_X+112 -#define BAR_TRN_X BAR_X+124 -#define BAR_VOLUME_X BAR_X+140 -#define BAR_TIME_X BAR_X+165 +#define BAR_NOTIFS_X BAR_X+133 +#define BAR_VOLUME_X BAR_X+147 +#define BAR_TIME_X BAR_X+168 void displayTopBarGauge(xcoord_t x, uint8_t count, bool blinking=false) { @@ -219,31 +225,60 @@ void displayTopBarGauge(xcoord_t x, uint8_t count, bool blinking=false) lcd_vline(x+2+i, BAR_Y+3, 3); } +#define LCD_NOTIF_ICON(x, icon) \ + lcd_bmp(x, BAR_Y, icons, icon); \ + lcd_hline(x, BAR_Y+8, 11) + void displayTopBar() { /* Tx voltage */ putsVBat(BAR_BATT_X, BAR_Y+1, 0); - lcd_rect(VBATT_X, BAR_Y+1, 13, 7); - lcd_vline(VBATT_X+13, BAR_Y+2, 5); + lcd_rect(BAR_BATT_X+FW, BAR_Y+1, 13, 7); + lcd_vline(BAR_BATT_X+FW+13, BAR_Y+2, 5); /* RSSI */ LCD_ICON(BAR_RSSI_X, BAR_Y, ICON_RSSI); lcd_rect(BAR_RSSI_X+10, BAR_Y+1, 13, 7); - /* SD icon */ - LCD_ICON(BAR_SD_X, BAR_Y, ICON_SD); - lcd_hline(BAR_SD_X, BAR_Y+8, 11); + /* Notifs icons */ + xcoord_t x = BAR_NOTIFS_X; + if (unexpectedShutdown) { + LCD_NOTIF_ICON(x, ICON_REBOOT); + x -= 12; + } - /* Logs icon */ - LCD_ICON(BAR_LOGS_X, BAR_Y, ICON_LOGS); - lcd_hline(BAR_LOGS_X, BAR_Y+8, 11); + if (1) { + LCD_NOTIF_ICON(x, ICON_USB); + x -= 12; + } - /* Trainer icon */ - LCD_ICON(BAR_TRN_X, BAR_Y, ICON_TRAINER); - lcd_hline(BAR_TRN_X, BAR_Y+8, 11); + if (SLAVE_MODE()) { + LCD_NOTIF_ICON(x, ICON_TRAINEE); + x -= 12; + } + else if (1) { + LCD_NOTIF_ICON(x, ICON_TRAINER); + x -= 12; + } + + if (isFunctionActive(FUNC_LOGS)) { + LCD_NOTIF_ICON(x, ICON_LOGS); + x -= 12; + } + + if (sdMounted()) { + LCD_NOTIF_ICON(x, ICON_SD); + } /* Audio volume */ - LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER); + if (requiredSpeakerVolume == 0) + LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER0); + else if (requiredSpeakerVolume < 10) + LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER1); + else if (requiredSpeakerVolume < 20) + LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER2); + else + LCD_ICON(BAR_VOLUME_X, BAR_Y, ICON_SPEAKER3); /* RTC time */ struct gtm t; @@ -253,11 +288,11 @@ void displayTopBar() lcd_outdezNAtt(BAR_TIME_X+3*FWNUM-1, BAR_Y+1, t.tm_min, LEADING0, 2); /* The background */ - lcd_filled_rect(BAR_X, BAR_Y, 182, 9, SOLID, FILL_WHITE|GREY_DEFAULT); + lcd_filled_rect(BAR_X, BAR_Y, BAR_W, BAR_H, SOLID, FILL_WHITE|GREY_DEFAULT); /* The inside of the Batt gauge */ uint8_t count = 10 * (g_vbat100mV - g_eeGeneral.vBatMin - 90) / (30 + g_eeGeneral.vBatMax - g_eeGeneral.vBatMin); - displayTopBarGauge(VBATT_X, count, g_vbat100mV <= g_eeGeneral.vBatWarn); + displayTopBarGauge(BAR_BATT_X+FW, count, g_vbat100mV <= g_eeGeneral.vBatWarn); /* The inside of the RSSI gauge */ count = min(frskyData.rssi[0].value, frskyData.rssi[1].value) / 10; diff --git a/src/open9x.h b/src/open9x.h index 152537beb..ab5b49a95 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -1242,6 +1242,10 @@ enum AUDIO_SOUNDS { #include "rtc.h" #endif +#if defined(CPUARM) +extern uint8_t requiredSpeakerVolume; +#endif + // Re-useable byte array to save having multiple buffers #define SD_SCREEN_FILE_LENGTH (32) union ReusableBuffer