Projectkk2glider/flash savings (#4199)

* Flash savings: getFileExtension() de-templated, saves 160 bytes

* Flash savings: several variables moved to rodata, RGB macro optimization (speed and can now be used to initialize rodata)

Result for Horus:
   text	   data	    bss	    dec
1261182	 808603	  42020	2111805   before
1267149	 803335	  42124	2112608   after (data size also counts .sram section)

5kB saved in .data section (RAM and FLASH)

* Removed compiler warnings

* RGB() and ARGB() gtests added

* ARGB() optimized
This commit is contained in:
Damjan Adamic
2017-01-05 21:44:59 +01:00
committed by Bertrand Songis
parent 3b58ee8d3c
commit 82dce3ee60
14 changed files with 120 additions and 67 deletions
@@ -258,7 +258,7 @@ void menuRadioSdManager(event_t _event)
break; // no menu for parent dir
}
#if defined(CPUARM)
char * ext = getFileExtension(line);
const char * ext = getFileExtension(line);
if (ext) {
if (!strcasecmp(ext, SOUNDS_EXT)) {
POPUP_MENU_ADD_ITEM(STR_PLAY_FILE);
@@ -401,7 +401,7 @@ void menuRadioSdManager(event_t _event)
#if defined(CPUARM)
if (s_editMode == EDIT_MODIFY_STRING && attr) {
uint8_t extlen, efflen;
char * ext = getFileExtension(reusableBuffer.sdmanager.originalName, 0, 0, NULL, &extlen);
const char * ext = getFileExtension(reusableBuffer.sdmanager.originalName, 0, 0, NULL, &extlen);
editName(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], SD_SCREEN_FILE_LENGTH - extlen, _event, attr, 0);
efflen = effectiveLen(reusableBuffer.sdmanager.lines[i], SD_SCREEN_FILE_LENGTH - extlen);
if (s_editMode == 0) {
@@ -428,7 +428,7 @@ void menuRadioSdManager(event_t _event)
}
#if LCD_DEPTH > 1
char * ext = getFileExtension(reusableBuffer.sdmanager.lines[index]);
const char * ext = getFileExtension(reusableBuffer.sdmanager.lines[index]);
if (ext && isExtensionMatching(ext, BITMAPS_EXT)) {
if (lastPos != menuVerticalPosition) {
if (!lcdLoadBitmap(modelBitmap, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) {