Skip to content

Commit

Permalink
touch calibration after 15 sec.
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Apr 30, 2020
1 parent 03ea1d7 commit 71e3dd7
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 5 deletions.
3 changes: 3 additions & 0 deletions modular-psu-firmware.eez-project
Original file line number Diff line number Diff line change
Expand Up @@ -3029,6 +3029,9 @@
},
{
"name": "ch_settings_calibration_view_points"
},
{
"name": "show_touch_calibration_intro"
}
],
"gui": {
Expand Down
4 changes: 4 additions & 0 deletions src/eez/action_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ void action_enter_touch_calibration() {
psu::gui::enterTouchCalibration();
}

void action_show_touch_calibration_intro() {
showPage(PAGE_ID_TOUCH_CALIBRATION_INTRO);
}

void action_yes() {
dialogYes();
}
Expand Down
4 changes: 4 additions & 0 deletions src/eez/gui/app_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ int AppContext::getLongTouchActionHook(const WidgetCursor &widgetCursor) {
return ACTION_ID_NONE;
}

int AppContext::getExtraLongTouchActionHook(const WidgetCursor &widgetCursor) {
return ACTION_ID_NONE;
}

} // namespace gui
} // namespace eez

Expand Down
1 change: 1 addition & 0 deletions src/eez/gui/app_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class AppContext {
void updateAppView(WidgetCursor &widgetCursor);

virtual int getLongTouchActionHook(const WidgetCursor &widgetCursor);
virtual int getExtraLongTouchActionHook(const WidgetCursor &widgetCursor);

protected:
PageOnStack m_pageNavigationStack[CONF_GUI_PAGE_NAVIGATION_STACK_SIZE];
Expand Down
3 changes: 2 additions & 1 deletion src/eez/gui/document_simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,8 @@ ActionExecFunc g_actionExecFunctions[] = {
action_channel_calibration_point_delete,
action_channel_calibration_point_save,
action_channel_calibration_chart_zoom,
action_ch_settings_calibration_view_points
action_ch_settings_calibration_view_points,
action_show_touch_calibration_intro
};

// ASSETS DEFINITION
Expand Down
4 changes: 3 additions & 1 deletion src/eez/gui/document_simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,8 @@ enum ActionsEnum {
ACTION_ID_CHANNEL_CALIBRATION_POINT_DELETE = 221,
ACTION_ID_CHANNEL_CALIBRATION_POINT_SAVE = 222,
ACTION_ID_CHANNEL_CALIBRATION_CHART_ZOOM = 223,
ACTION_ID_CH_SETTINGS_CALIBRATION_VIEW_POINTS = 224
ACTION_ID_CH_SETTINGS_CALIBRATION_VIEW_POINTS = 224,
ACTION_ID_SHOW_TOUCH_CALIBRATION_INTRO = 225
};

void action_channel_toggle_output();
Expand Down Expand Up @@ -1292,6 +1293,7 @@ void action_channel_calibration_point_delete();
void action_channel_calibration_point_save();
void action_channel_calibration_chart_zoom();
void action_ch_settings_calibration_view_points();
void action_show_touch_calibration_intro();

extern ActionExecFunc g_actionExecFunctions[];

Expand Down
3 changes: 2 additions & 1 deletion src/eez/gui/document_stm32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,8 @@ ActionExecFunc g_actionExecFunctions[] = {
action_channel_calibration_point_delete,
action_channel_calibration_point_save,
action_channel_calibration_chart_zoom,
action_ch_settings_calibration_view_points
action_ch_settings_calibration_view_points,
action_show_touch_calibration_intro
};

// ASSETS DEFINITION
Expand Down
4 changes: 3 additions & 1 deletion src/eez/gui/document_stm32.h
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,8 @@ enum ActionsEnum {
ACTION_ID_CHANNEL_CALIBRATION_POINT_DELETE = 217,
ACTION_ID_CHANNEL_CALIBRATION_POINT_SAVE = 218,
ACTION_ID_CHANNEL_CALIBRATION_CHART_ZOOM = 219,
ACTION_ID_CH_SETTINGS_CALIBRATION_VIEW_POINTS = 220
ACTION_ID_CH_SETTINGS_CALIBRATION_VIEW_POINTS = 220,
ACTION_ID_SHOW_TOUCH_CALIBRATION_INTRO = 221
};

void action_channel_toggle_output();
Expand Down Expand Up @@ -1268,6 +1269,7 @@ void action_channel_calibration_point_delete();
void action_channel_calibration_point_save();
void action_channel_calibration_chart_zoom();
void action_ch_settings_calibration_view_points();
void action_show_touch_calibration_intro();

extern ActionExecFunc g_actionExecFunctions[];

Expand Down
8 changes: 7 additions & 1 deletion src/eez/gui/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define CONF_GUI_LONG_TOUCH_TIMEOUT 1000000L // 1s
#define CONF_GUI_KEYPAD_FIRST_AUTO_REPEAT_DELAY 300000L // 300ms
#define CONF_GUI_KEYPAD_NEXT_AUTO_REPEAT_DELAY 50000L // 50ms
#define CONF_GUI_EXTRA_LONG_TOUCH_TIMEOUT 15000000L // 30s
#define CONF_GUI_EXTRA_LONG_TOUCH_TIMEOUT 15000000L // 15s

namespace eez {
namespace gui {
Expand Down Expand Up @@ -173,6 +173,12 @@ static void onWidgetDefaultTouch(const WidgetCursor &widgetCursor, Event &touchE
if (action != ACTION_ID_NONE) {
executeAction(action);
}
} else if (touchEvent.type == EVENT_TYPE_EXTRA_LONG_TOUCH) {
m_touchActionExecuted = true;
int action = widgetCursor.appContext->getExtraLongTouchActionHook(widgetCursor);
if (action != ACTION_ID_NONE) {
executeAction(action);
}
} else if (touchEvent.type == EVENT_TYPE_TOUCH_UP) {
if (!m_touchActionExecutedAtDown) {
m_activeWidget = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/eez/modules/psu/gui/psu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,10 @@ void PsuAppContext::dialogClose() {
}
}

int PsuAppContext::getExtraLongTouchActionHook(const WidgetCursor &widgetCursor) {
return ACTION_ID_SHOW_TOUCH_CALIBRATION_INTRO;
}

void MenuInputParams::onSet(int value) {
popPage();

Expand Down
2 changes: 2 additions & 0 deletions src/eez/modules/psu/gui/psu.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ class PsuAppContext : public AppContext {
void (*m_dialogCancelCallback)();
void (*m_dialogLaterCallback)();

int getExtraLongTouchActionHook(const WidgetCursor &widgetCursor) override;

protected:
bool m_pushProgressPage;
const char *m_progressMessage;
Expand Down

0 comments on commit 71e3dd7

Please sign in to comment.