Skip to content

Commit

Permalink
gui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Jul 16, 2019
1 parent a237ff3 commit ad10db0
Show file tree
Hide file tree
Showing 16 changed files with 19,187 additions and 19,072 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ set(src_eez_apps_psu_scpi
src/eez/apps/psu/scpi/outp.cpp
src/eez/apps/psu/scpi/params.cpp
src/eez/apps/psu/scpi/psu.cpp
src/eez/apps/psu/scpi/regs.cpp
src/eez/apps/psu/scpi/sense.cpp
src/eez/apps/psu/scpi/simu.cpp
src/eez/apps/psu/scpi/sour.cpp
Expand All @@ -246,7 +245,6 @@ list (APPEND src_files ${src_eez_apps_psu_scpi})
set(header_eez_apps_psu_scpi
src/eez/apps/psu/scpi/params.h
src/eez/apps/psu/scpi/psu.h
src/eez/apps/psu/scpi/regs.h
)
list (APPEND header_files ${header_eez_apps_psu_scpi})
source_group("eez\\apps\\psu\\scpi" FILES ${src_eez_apps_psu_scpi} ${header_eez_apps_psu_scpi})
Expand Down Expand Up @@ -457,13 +455,15 @@ list (APPEND header_files ${header_eez_platform_simulator})
source_group("eez\\platform\\simulator" FILES ${src_eez_platform_simulator} ${header_eez_platform_simulator})

set(src_eez_scpi
src/eez/scpi/regs.cpp
src/eez/scpi/scpi.cpp
)
list (APPEND src_files ${src_eez_scpi})
set(header_eez_scpi
src/eez/scpi/commands.h
src/eez/scpi/commands_simulator.h
src/eez/scpi/commands_stm32.h
src/eez/scpi/regs.h
src/eez/scpi/scpi.h
src/eez/scpi/scpi_user_config.h
)
Expand Down
51 changes: 50 additions & 1 deletion modular-psu-firmware.eez-project
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@
"name": "ethernet.status",
"description": "0: failed\n1: ok\n2: skipped\n3: warning",
"type": "enum",
"enumItems": "[\n\"Failed\",\n\"OK\",\n\"Skipped\",\n\"Warning\"\n]",
"enumItems": "[\n\"Failed\",\n\"OK\",\n\"Connecting\",\n\"Skipped\",\n\"Warning\"\n]",
"defaultValue": "1"
},
{
Expand Down Expand Up @@ -23201,6 +23201,38 @@
"height": 26,
"widgets": []
},
{
"type": "Container",
"style": {
"inheritFrom": "default",
"padding": 0
},
"activeStyle": {
"padding": 0
},
"left": 0,
"top": 0,
"width": 246,
"height": 26,
"widgets": [
{
"type": "Text",
"style": {
"inheritFrom": "event_info",
"padding": 0,
"blink": true
},
"activeStyle": {
"padding": 0
},
"left": 0,
"top": 0,
"width": 246,
"height": 26,
"text": "Connecting ..."
}
]
},
{
"type": "Container",
"style": {
Expand Down Expand Up @@ -34856,6 +34888,23 @@
}
]
},
{
"type": "Text",
"style": {
"inheritFrom": "button_indicator_off",
"padding": 0,
"blink": true
},
"activeStyle": {
"padding": 0
},
"action": "show_sys_settings_ethernet",
"left": 0,
"top": 0,
"width": 28,
"height": 28,
"text": "\\u0095"
},
{
"type": "Rectangle",
"style": {
Expand Down
6 changes: 4 additions & 2 deletions src/eez/apps/home/home.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ void HomeAppContext::stateManagment() {

// turn the screen off if power is down
if (!psu::isPowerUp()) {
showPage(INTERNAL_PAGE_ID_NONE);
eez::mcu::display::turnOff();
if (getActivePageId() != INTERNAL_PAGE_ID_NONE) {
showPage(INTERNAL_PAGE_ID_NONE);
eez::mcu::display::turnOff();
}
return;
}

Expand Down
10 changes: 6 additions & 4 deletions src/eez/apps/psu/scpi/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ scpi_result_t scpi_cmd_displayWindowTextClear(scpi_t *context) {
#endif
}

uint8_t g_line[10][480 * 3];

scpi_result_t scpi_cmd_displayDataQ(scpi_t *context) {
// TODO migrate to generic firmware
#if OPTION_DISPLAY
Expand Down Expand Up @@ -221,10 +223,10 @@ scpi_result_t scpi_cmd_displayDataQ(scpi_t *context) {

mcu::display::screanshotBegin();

uint8_t line[480 * 3];
while (mcu::display::screanshotGetLine(line)) {
SCPI_ResultArbitraryBlockData(context, line, sizeof(line));
osDelay(0);
int i = 0;
while (mcu::display::screanshotGetLine(g_line[i])) {
SCPI_ResultArbitraryBlockData(context, g_line[i], sizeof(g_line[i]));
i = (i + 1) % 10;
}

mcu::display::screanshotEnd();
Expand Down
15 changes: 12 additions & 3 deletions src/eez/gui/app_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ AppContext::AppContext() {
m_pushProgressPage = false;
m_popProgressPage = false;
m_setPageIdOnNextIter = false;
m_isTopPage = true;
}


Expand Down Expand Up @@ -305,7 +306,9 @@ bool AppContext::isPageActiveOrOnStack(int pageId) {
}

void AppContext::showPage(int pageId) {
setPage(pageId);
if (pageId != getActivePageId()) {
setPage(pageId);
}
}

void AppContext::showPageOnNextIter(int pageId) {
Expand All @@ -316,12 +319,14 @@ void AppContext::showPageOnNextIter(int pageId) {
void AppContext::pushSelectFromEnumPage(const data::EnumItem *enumDefinition, uint8_t currentValue,
bool (*disabledCallback)(uint8_t value),
void (*onSet)(uint8_t)) {
pushPage(INTERNAL_PAGE_ID_SELECT_FROM_ENUM, new SelectFromEnumPage(enumDefinition, currentValue, disabledCallback, onSet));
m_selectFromEnumPage.init(enumDefinition, currentValue, disabledCallback, onSet);
pushPage(INTERNAL_PAGE_ID_SELECT_FROM_ENUM, &m_selectFromEnumPage);
}

void AppContext::pushSelectFromEnumPage(void (*enumDefinitionFunc)(data::DataOperationEnum operation, data::Cursor &cursor, data::Value &value),
uint8_t currentValue, bool (*disabledCallback)(uint8_t value), void (*onSet)(uint8_t)) {
pushPage(INTERNAL_PAGE_ID_SELECT_FROM_ENUM, new SelectFromEnumPage(enumDefinitionFunc, currentValue, disabledCallback, onSet));
m_selectFromEnumPage.init(enumDefinitionFunc, currentValue, disabledCallback, onSet);
pushPage(INTERNAL_PAGE_ID_SELECT_FROM_ENUM, &m_selectFromEnumPage);
}

void AppContext::markForRefreshAppView() {
Expand Down Expand Up @@ -459,6 +464,8 @@ void AppContext::updateAppView(WidgetCursor &widgetCursor) {
m_activePageIdSaved = m_activePageId;
Page *activePageSaved = m_activePage;

m_isTopPage = false;

for (++i; i < m_pageNavigationStackPointer; i++) {

bool paintedSaved = mcu::display::g_painted;
Expand All @@ -480,6 +487,8 @@ void AppContext::updateAppView(WidgetCursor &widgetCursor) {
widgetCursor.currentState = nextWidgetState(widgetCursor.currentState);
}

m_isTopPage = true;

m_activePageId = m_activePageIdSaved;
m_activePageIdSaved = INTERNAL_PAGE_ID_NONE;
m_activePage = activePageSaved;
Expand Down
6 changes: 6 additions & 0 deletions src/eez/gui/app_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class AppContext {
int getActivePageId();
Page *getActivePage();
bool isActivePage(int pageId);
bool isActivePageTopPage() {
return m_isTopPage;
}

bool isActivePageInternal();
InternalPage *getActivePageInternal() {
Expand Down Expand Up @@ -120,6 +123,7 @@ class AppContext {

//
int m_activePageId = INTERNAL_PAGE_ID_NONE;
bool m_isTopPage;
int m_activePageIdSaved;
Page *m_activePage = nullptr;
bool m_repaintActivePage;
Expand All @@ -137,6 +141,8 @@ class AppContext {

bool m_popProgressPage;

SelectFromEnumPage m_selectFromEnumPage;

void doShowPage(int index, Page *page = 0);
void setPage(int pageId);

Expand Down
Loading

0 comments on commit ad10db0

Please sign in to comment.