Initial rough cut form of getting bmp's shown on-screen that are stored on sd card

This commit is contained in:
KemoNine 2020-09-28 01:24:13 -04:00
parent a660ebc092
commit 504bfe8abe
10 changed files with 90 additions and 14 deletions

View file

@ -40,6 +40,7 @@ These libraries are used by the project and can be installed via the Arduino IDE
- Button for accessing password selection pop-up to help with password entry over serial
- This should be configured via a text file on the sd card
- Way to display pinouts stored on micro sd card
- **YOU WILL NEED TO UPDATE THE CODE TO ADD NEW IMAGES**
- Max number of files is 20
- Max filename length is 24 (this includes the ```.``` and extension of the file)
- The pinouts should be stored as bmp files *up to* 24 bit

View file

@ -105,7 +105,6 @@ void listPrevious(gslc_tsElemRef*);
//<Save_References !Start!>
gslc_tsElemRef* m_SliderDiagrams = NULL;
gslc_tsElemRef* m_pElemBatteryLevel= NULL;
gslc_tsElemRef* m_pElemImgPin = NULL;
gslc_tsElemRef* m_pElemLsDiagrams = NULL;
gslc_tsElemRef* m_pElemRd1152 = NULL;
gslc_tsElemRef* m_pElemRd96 = NULL;
@ -115,6 +114,12 @@ gslc_tsElemRef* m_pElemRdUARTA = NULL;
gslc_tsElemRef* m_pElemSDInfo = NULL;
gslc_tsElemRef* m_pElemStatusText = NULL;
gslc_tsElemRef* m_pElemText = NULL;
gslc_tsElemRef* pImgFthM0Bsc = NULL;
gslc_tsElemRef* pImgKbdFw = NULL;
gslc_tsElemRef* pImgPi4Overview = NULL;
gslc_tsElemRef* pImgPi4Pins = NULL;
gslc_tsElemRef* pImgPiOrientation = NULL;
gslc_tsElemRef* pImgRpi = NULL;
//<Save_References !End!>
// Keyboard map related
@ -365,8 +370,13 @@ void handlerKeyboard() {
// Process key press events
if (key.state == BBQ10Keyboard::StatePress) {
// Override ALL keyboard handling and hide popup if it's on-screen
if (popupOnScreen) {
gslc_PopupHide(&m_gui);
popupOnScreen = false;
}
// Move right through screens
if (key.key == KBD_BTN_4) {
else if (key.key == KBD_BTN_4) {
if (popupOnScreen) {
// Do nothing -- need to clear popup first
}
@ -413,7 +423,29 @@ void handlerKeyboard() {
}
}
else if (key.key == KBD_SW_OK) {
uiKeyBuffer.push(key.key);
if (gslc_GetPageCur(&m_gui) == E_WIRING) {
int16_t selection = gslc_ElemXListboxGetSel(&m_gui, m_pElemLsDiagrams);
char selectionText[MAX_FILE_NAME_CHARS];
gslc_ElemXListboxGetItem(&m_gui, m_pElemLsDiagrams, selection, selectionText, MAX_FILE_NAME_CHARS);
#if defined(DBG_LOG) || defined(DBG_TOUCH) || defined(DBG_FRAME_RATE) || defined(DBG_DRAW_IMM) || defined(DBG_DRIVER)
Serial.println(selectionText);
#endif
char fullPath[sizeof(DIRECTORY_PINOUTS) + 1 + MAX_FILE_NAME_CHARS];
strncat(fullPath, DIRECTORY_PINOUTS, sizeof(DIRECTORY_PINOUTS));
strncat(fullPath, "/", sizeof(char));
strncat(fullPath, selectionText, MAX_FILE_NAME_CHARS);
#if defined(DBG_LOG) || defined(DBG_TOUCH) || defined(DBG_FRAME_RATE) || defined(DBG_DRAW_IMM) || defined(DBG_DRIVER)
Serial.println(fullPath);
#endif
// gslc_tsImgRef imageRef = gslc_GetImageFromSD(fullPath, GSLC_IMGREF_FMT_BMP24);
// gslc_ElemSetImage(&m_gui, m_pElemImgPin, imageRef, imageRef);
gslc_PopupShow(&m_gui, E_PG_DIAGRAM, true);
popupOnScreen = true;
}
else {
uiKeyBuffer.push(key.key);
}
}
// Process keys 'normally'
else {

Binary file not shown.

View file

@ -49,6 +49,12 @@
// Defines for resources
// ------------------------------------------------
//<Resources !Start!>
#define IMG_FEATHERM0BSC "/pinouts/feather-m0-bsc.bmp"
#define IMG_KBDFW "/pinouts/kbd-fw.bmp"
#define IMG_PI4OVERVIEW "/pinouts/pi4-overview.bmp"
#define IMG_PI4PINS "/pinouts/pi4-pins.bmp"
#define IMG_PIORIENTATION "/pinouts/pi-orientation.bmp"
#define IMG_RPI "/pinouts/rpi.bmp"
//<Resources !End!>
// ------------------------------------------------
@ -56,11 +62,13 @@
// ------------------------------------------------
//<Enum !Start!>
enum {E_PG_BASE,E_PG_MAIN,E_CONF_RPI,E_WIRING,E_SD_CARD,E_PG_DIAGRAM};
enum {E_ELEM_BATT_LEVEL,E_ELEM_IMG_PIN,E_ELEM_LS_DIA,E_ELEM_RD96
,E_ELEM_RD_1152,E_ELEM_RD_UART0,E_ELEM_RD_UART5,E_ELEM_RD_UARTA
,E_ELEM_STATUS,E_ELEM_TEXT,E_ELEM_TEXT11,E_ELEM_TEXT3
,E_ELEM_TEXT4,E_ELEM_TX96,E_ELEM_TX_1152,E_ELEM_TX_SD_INFO
,E_ELEM_TX_UART1,E_ELEM_TX_UART5,E_SLR_DIAGRAMS,E_STATUS_LINE};
enum {E_ELEM_BATT_LEVEL,E_ELEM_IMG_FTH,E_ELEM_IMG_FW,E_ELEM_IMG_PI
,E_ELEM_IMG_PI4A,E_ELEM_IMG_PI4B,E_ELEM_IMG_PIB,E_ELEM_LS_DIA
,E_ELEM_RD96,E_ELEM_RD_1152,E_ELEM_RD_UART0,E_ELEM_RD_UART5
,E_ELEM_RD_UARTA,E_ELEM_STATUS,E_ELEM_TEXT,E_ELEM_TEXT11
,E_ELEM_TEXT3,E_ELEM_TEXT4,E_ELEM_TX96,E_ELEM_TX_1152
,E_ELEM_TX_SD_INFO,E_ELEM_TX_UART1,E_ELEM_TX_UART5,E_SLR_DIAGRAMS
,E_STATUS_LINE};
enum {E_GRP_SPD,E_GRP_UART};
// Must use separate enum for fonts with MAX_FONT at end to use gslc_FontSet.
enum {E_AO_NOTOMONO8PT7B,MAX_FONT};
@ -91,7 +99,7 @@ enum {E_AO_NOTOMONO8PT7B,MAX_FONT};
#define MAX_ELEM_SD_CARD 1 // # Elems total on page
#define MAX_ELEM_SD_CARD_RAM MAX_ELEM_SD_CARD // # Elems in RAM
#define MAX_ELEM_PG_DIAGRAM 1 // # Elems total on page
#define MAX_ELEM_PG_DIAGRAM 6 // # Elems total on page
#define MAX_ELEM_PG_DIAGRAM_RAM MAX_ELEM_PG_DIAGRAM // # Elems in RAM
//<ElementDefines !End!>
@ -143,7 +151,6 @@ char m_acTextboxBuf3[696]; // NRows=12 NCols=58
//<Extern_References !Start!>
extern gslc_tsElemRef* m_SliderDiagrams;
extern gslc_tsElemRef* m_pElemBatteryLevel;
extern gslc_tsElemRef* m_pElemImgPin;
extern gslc_tsElemRef* m_pElemLsDiagrams;
extern gslc_tsElemRef* m_pElemRd1152;
extern gslc_tsElemRef* m_pElemRd96;
@ -155,6 +162,12 @@ extern gslc_tsElemRef* m_pElemStatusText;
extern gslc_tsElemRef* m_pElemText;
extern gslc_tsElemRef* m_pTextSlider;
extern gslc_tsElemRef* m_pTextSlider3;
extern gslc_tsElemRef* pImgFthM0Bsc;
extern gslc_tsElemRef* pImgKbdFw;
extern gslc_tsElemRef* pImgPi4Overview;
extern gslc_tsElemRef* pImgPi4Pins;
extern gslc_tsElemRef* pImgPiOrientation;
extern gslc_tsElemRef* pImgRpi;
//<Extern_References !End!>
// Define debug message function
@ -355,11 +368,41 @@ void InitGUIslice_gen()
// PAGE: E_PG_DIAGRAM
// Create E_ELEM_IMG_PIN using Image
pElemRef = gslc_ElemCreateImg(&m_gui,E_ELEM_IMG_PIN,E_PG_DIAGRAM,(gslc_tsRect){0,0,320,240},
gslc_GetImageFromSD(NULL,GSLC_IMGREF_FMT_RAW1));
// Create E_ELEM_IMG_FTH using Image
pElemRef = gslc_ElemCreateImg(&m_gui,E_ELEM_IMG_FTH,E_PG_DIAGRAM,(gslc_tsRect){0,37,320,166},
gslc_GetImageFromSD((const char*)IMG_FEATHERM0BSC,GSLC_IMGREF_FMT_BMP24));
gslc_ElemSetFillEn(&m_gui,pElemRef,false);
m_pElemImgPin = pElemRef;
pImgFthM0Bsc = pElemRef;
// Create E_ELEM_IMG_PI4A using Image
pElemRef = gslc_ElemCreateImg(&m_gui,E_ELEM_IMG_PI4A,E_PG_DIAGRAM,(gslc_tsRect){81,0,156,240},
gslc_GetImageFromSD((const char*)IMG_PI4OVERVIEW,GSLC_IMGREF_FMT_BMP24));
gslc_ElemSetFillEn(&m_gui,pElemRef,false);
pImgPi4Overview = pElemRef;
// Create E_ELEM_IMG_PI4B using Image
pElemRef = gslc_ElemCreateImg(&m_gui,E_ELEM_IMG_PI4B,E_PG_DIAGRAM,(gslc_tsRect){54,0,210,240},
gslc_GetImageFromSD((const char*)IMG_PI4PINS,GSLC_IMGREF_FMT_BMP24));
gslc_ElemSetFillEn(&m_gui,pElemRef,false);
pImgPi4Pins = pElemRef;
// Create E_ELEM_IMG_PIB using Image
pElemRef = gslc_ElemCreateImg(&m_gui,E_ELEM_IMG_PIB,E_PG_DIAGRAM,(gslc_tsRect){80,0,158,240},
gslc_GetImageFromSD((const char*)IMG_PIORIENTATION,GSLC_IMGREF_FMT_BMP24));
gslc_ElemSetFillEn(&m_gui,pElemRef,false);
pImgPiOrientation = pElemRef;
// Create E_ELEM_IMG_PI using Image
pElemRef = gslc_ElemCreateImg(&m_gui,E_ELEM_IMG_PI,E_PG_DIAGRAM,(gslc_tsRect){39,0,241,240},
gslc_GetImageFromSD((const char*)IMG_RPI,GSLC_IMGREF_FMT_BMP24));
gslc_ElemSetFillEn(&m_gui,pElemRef,false);
pImgRpi = pElemRef;
// Create E_ELEM_IMG_FW using Image
pElemRef = gslc_ElemCreateImg(&m_gui,E_ELEM_IMG_FW,E_PG_DIAGRAM,(gslc_tsRect){2,0,317,240},
gslc_GetImageFromSD((const char*)IMG_KBDFW,GSLC_IMGREF_FMT_BMP24));
gslc_ElemSetFillEn(&m_gui,pElemRef,false);
pImgKbdFw = pElemRef;
//<InitGUI !End!>
//<Startup !Start!>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 KiB

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 KiB

After

Width:  |  Height:  |  Size: 170 KiB