Skip to content

Commit

Permalink
low priority task stack size increased
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Dec 4, 2021
1 parent 94fc60c commit aabbbb8
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 103 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"list": "cpp",
"xtree": "cpp",
"cstdlib": "cpp",
"stddef.h": "c"
"stddef.h": "c",
"ios": "cpp",
"xhash": "cpp"
},
"C_Cpp.errorSquiggles": "Disabled",
"cmake.configureOnOpen": true
Expand Down
2 changes: 2 additions & 0 deletions src/bb3/bp3c/flash_slave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ void leaveBootloaderMode() {

psu::initChannels();
psu::testChannels();
#else
g_bootloaderMode = false;
#endif

psu::profile::recallFromLocation(10);
Expand Down
1 change: 0 additions & 1 deletion src/bb3/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ static void moveToPreviousFocusCursor();
////////////////////////////////////////////////////////////////////////////////

bool isDisplayDirty() {

if (g_lastFocusWidgetCursor != g_focusWidgetCursor) {
g_lastFocusWidgetCursor = g_focusWidgetCursor;
return true;
Expand Down
34 changes: 17 additions & 17 deletions src/bb3/mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ static bool g_mouseWasDown;
static int g_mouseWasCursorX;
static int g_mouseWasCursorY;

static WidgetCursor m_foundWidgetAtMouse;
static OnTouchFunctionType m_onTouchFunctionAtMouse;
static WidgetCursor g_foundWidgetAtMouse;
static OnTouchFunctionType g_onTouchFunctionAtMouse;

static bool g_lastMouseCursorVisible;
static int g_lastMouseCursorX;
Expand Down Expand Up @@ -89,8 +89,8 @@ void getEvent(bool &mouseCursorVisible, EventType &mouseEventType, int &mouseX,
g_mouseWasCursorX = g_mouseCursorX;
g_mouseWasCursorY = g_mouseCursorY;

m_foundWidgetAtMouse = findWidget(&getRootAppContext(), g_mouseCursorX, g_mouseCursorY, false);
m_onTouchFunctionAtMouse = getWidgetTouchFunction(m_foundWidgetAtMouse);
g_foundWidgetAtMouse = findWidget(&getRootAppContext(), g_mouseCursorX, g_mouseCursorY, false);
g_onTouchFunctionAtMouse = getWidgetTouchFunction(g_foundWidgetAtMouse);

mouseCursorVisible = true;
mouseX = g_mouseCursorX;
Expand All @@ -100,8 +100,8 @@ void getEvent(bool &mouseCursorVisible, EventType &mouseEventType, int &mouseX,
g_mouseWasCursorX = 0;
g_mouseWasCursorY = 0;

m_foundWidgetAtMouse = 0;
m_onTouchFunctionAtMouse = 0;
g_foundWidgetAtMouse = 0;
g_onTouchFunctionAtMouse = 0;

mouseCursorVisible = false;
mouseX = 0;
Expand All @@ -114,14 +114,14 @@ bool isDisplayDirty() {
g_lastMouseCursorVisible != g_mouseCursorVisible ||
g_lastMouseCursorX != g_mouseCursorX ||
g_lastMouseCursorY != g_mouseCursorY ||
g_lastFoundWidgetAtMouse != m_foundWidgetAtMouse ||
g_lastOnTouchFunctionAtMouse != m_onTouchFunctionAtMouse
g_lastFoundWidgetAtMouse != g_foundWidgetAtMouse ||
g_lastOnTouchFunctionAtMouse != g_onTouchFunctionAtMouse
) {
g_lastMouseCursorVisible = g_mouseCursorVisible;
g_lastMouseCursorX = g_mouseCursorX;
g_lastMouseCursorY = g_mouseCursorY;
g_lastFoundWidgetAtMouse = m_foundWidgetAtMouse;
g_lastOnTouchFunctionAtMouse = m_onTouchFunctionAtMouse;
g_lastFoundWidgetAtMouse = g_foundWidgetAtMouse;
g_lastOnTouchFunctionAtMouse = g_onTouchFunctionAtMouse;

return true;
}
Expand Down Expand Up @@ -153,20 +153,20 @@ void updateDisplay() {
image.height = getDisplayHeight() - g_lastMouseCursorY;
}

if (m_foundWidgetAtMouse && m_onTouchFunctionAtMouse) {
if (g_foundWidgetAtMouse && g_onTouchFunctionAtMouse) {
int16_t w;
int16_t h;

auto overlay = getOverlay(m_foundWidgetAtMouse);
auto overlay = getOverlay(g_foundWidgetAtMouse);
if (overlay && overlay->widgetOverrides) {
w = overlay->width;
h = overlay->height;
} else {
w = m_foundWidgetAtMouse.widget->w;
h = m_foundWidgetAtMouse.widget->h;
w = g_foundWidgetAtMouse.widget->w;
h = g_foundWidgetAtMouse.widget->h;
}

drawFocusFrame(m_foundWidgetAtMouse.x, m_foundWidgetAtMouse.y, w, h);
drawFocusFrame(g_foundWidgetAtMouse.x, g_foundWidgetAtMouse.y, w, h);
}

display::drawBitmap(&image, g_lastMouseCursorX, g_lastMouseCursorY);
Expand All @@ -175,8 +175,8 @@ void updateDisplay() {
}

void onPageChanged() {
m_foundWidgetAtMouse = 0;
m_onTouchFunctionAtMouse = 0;
g_foundWidgetAtMouse = 0;
g_onTouchFunctionAtMouse = 0;
}

void onMouseXMove(int x) {
Expand Down
2 changes: 1 addition & 1 deletion src/bb3/psu/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ struct Channel {
/// \param channel_index Zero based channel index, greater then or equal to 0 and less then
/// CH_MAX. \returns Reference to channel.
static inline Channel &get(int channelIndex) {
return *g_channels[channelIndex < 0 ? 0 : channelIndex >= CH_NUM ? CH_NUM - 1 : channelIndex];
return *g_channels[channelIndex];
}

static inline Channel *getBySlotIndex(uint8_t slotIndex, uint8_t subchannelIndex = 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/bb3/psu/dlog_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2686,7 +2686,7 @@ void data_dlog_visible_value_offset(DataOperationEnum operation, const WidgetCur
auto cursor = widgetCursor.cursor;
auto &recording = dlog_view::getRecording();
WidgetCursor dlogValueOffsetWidgetCursor = widgetCursor;
dlogValueOffsetWidgetCursor = getSelectedDlogValueIndex(recording, cursor);
dlogValueOffsetWidgetCursor.cursor = getSelectedDlogValueIndex(recording, cursor);
data_dlog_value_offset(operation, dlogValueOffsetWidgetCursor, value);
}

Expand Down Expand Up @@ -3099,13 +3099,13 @@ void data_dlog_y_value_is_selected(DataOperationEnum operation, const WidgetCurs

void data_dlog_y_value_offset(DataOperationEnum operation, const WidgetCursor &widgetCursor, Value &value) {
WidgetCursor dlogValueOffsetWidgetCursor = widgetCursor;
dlogValueOffsetWidgetCursor = getRecording().selectedValueIndex;
dlogValueOffsetWidgetCursor.cursor = getRecording().selectedValueIndex;
data_dlog_value_offset(operation, dlogValueOffsetWidgetCursor, value);
}

void data_dlog_y_value_div(DataOperationEnum operation, const WidgetCursor &widgetCursor, Value &value) {
WidgetCursor dlogValueDivWidgetCursor = widgetCursor;
dlogValueDivWidgetCursor = getRecording().selectedValueIndex;
dlogValueDivWidgetCursor.cursor = getRecording().selectedValueIndex;
data_dlog_value_div(operation, dlogValueDivWidgetCursor, value);
}

Expand Down
12 changes: 6 additions & 6 deletions src/bb3/psu/gui/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1529,27 +1529,27 @@ static int16_t g_editValueDataId;
void onSetFloatValue(float value) {
popPage();
WidgetCursor widgetCursor;
widgetCursor = g_editValueCursor;
widgetCursor.cursor = g_editValueCursor;
set(widgetCursor, g_editValueDataId, MakeValue(value, getUnit(widgetCursor, g_editValueDataId)));
}

void onSetInfinityValue() {
popPage();
WidgetCursor widgetCursor;
widgetCursor = g_editValueCursor;
widgetCursor.cursor = g_editValueCursor;
set(widgetCursor, g_editValueDataId, MakeValue(INFINITY, getUnit(widgetCursor, g_editValueDataId)));
}

void onSetUInt16Value(float value) {
popPage();
WidgetCursor widgetCursor;
widgetCursor = g_editValueCursor;
widgetCursor.cursor = g_editValueCursor;
set(widgetCursor, g_editValueDataId, Value((uint16_t)value, VALUE_TYPE_UINT16));
}

void onSetStringValue(char *value) {
WidgetCursor widgetCursor;
widgetCursor = g_editValueCursor;
widgetCursor.cursor = g_editValueCursor;
const char *errMessage = isValidValue(widgetCursor, g_editValueDataId, value);
if (!errMessage) {
popPage();
Expand All @@ -1562,7 +1562,7 @@ void onSetStringValue(char *value) {
void editValue(int16_t dataId) {
g_editValueDataId = dataId;
WidgetCursor widgetCursor;
widgetCursor = g_editValueCursor;
widgetCursor.cursor = g_editValueCursor;
Value value = get(widgetCursor, g_editValueDataId);

if (value.getType() == VALUE_TYPE_FLOAT) {
Expand Down Expand Up @@ -4580,7 +4580,7 @@ void data_channel_list_voltage(DataOperationEnum operation, const WidgetCursor &
StepValues *stepValues = value.getStepValues();

WidgetCursor uEditWidgetCursor = widgetCursor;
uEditWidgetCursor = g_channel->channelIndex;
uEditWidgetCursor.cursor = g_channel->channelIndex;
data_channel_u_edit(operation, uEditWidgetCursor, value);

stepValues->encoderSettings.range = g_channel->params.U_MAX;
Expand Down
2 changes: 1 addition & 1 deletion src/bb3/psu/gui/edit_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ void switchToNextEncoderMode() {
ChSettingsListsPage *page = (ChSettingsListsPage *)getPage(PAGE_ID_CH_SETTINGS_LISTS);
WidgetCursor widgetCursor;
if (page) {
widgetCursor = g_channel->channelIndex;
widgetCursor.cursor = g_channel->channelIndex;
setEncoderMode(widgetCursor, page->getDataIdAtCursor(), encoderMode);
} else {
widgetCursor = getFocusCursor();
Expand Down
12 changes: 6 additions & 6 deletions src/bb3/psu/gui/page_ch_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,14 @@ void ChSettingsListsPage::nextPage() {

bool ChSettingsListsPage::isFocusedValueEmpty() {
WidgetCursor widgetCursor;
widgetCursor = getCursorIndexWithinPage();
widgetCursor.cursor = getCursorIndexWithinPage();
Value value = get(widgetCursor, getDataIdAtCursor());
return value.getType() == VALUE_TYPE_STRING;
}

float ChSettingsListsPage::getFocusedValue() {
WidgetCursor widgetCursor;
widgetCursor = getCursorIndexWithinPage();
widgetCursor.cursor = getCursorIndexWithinPage();

Value value = get(widgetCursor, getDataIdAtCursor());

Expand All @@ -616,7 +616,7 @@ float ChSettingsListsPage::getFocusedValue() {

void ChSettingsListsPage::setFocusedValue(float value) {
WidgetCursor widgetCursor;
widgetCursor = getCursorIndexWithinPage();
widgetCursor.cursor = getCursorIndexWithinPage();

int16_t dataId = getDataIdAtCursor();

Expand Down Expand Up @@ -712,7 +712,7 @@ void ChSettingsListsPage::edit() {
options.subchannelIndex = g_channel->subchannelIndex;

WidgetCursor widgetCursor;
widgetCursor = getCursorIndexWithinPage();
widgetCursor.cursor = getCursorIndexWithinPage();

int16_t dataId = getDataIdAtCursor();

Expand Down Expand Up @@ -898,7 +898,7 @@ void ChSettingsListsPage::set() {
void ChSettingsListsPage::onEncoder(int counter) {
#if OPTION_ENCODER
WidgetCursor widgetCursor;
widgetCursor = getCursorIndexWithinPage();
widgetCursor.cursor = getCursorIndexWithinPage();

int16_t dataId = getDataIdAtCursor();

Expand Down Expand Up @@ -957,7 +957,7 @@ void ChSettingsListsPage::onEncoderClicked() {

Unit ChSettingsListsPage::getEncoderUnit() {
WidgetCursor widgetCursor;
widgetCursor = getCursorIndexWithinPage();
widgetCursor.cursor = getCursorIndexWithinPage();

Value value = get(widgetCursor, getDataIdAtCursor());

Expand Down
10 changes: 3 additions & 7 deletions src/bb3/psu/gui/psu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ bool PsuAppContext::isActiveWidget(const WidgetCursor &widgetCursor) {
}
}

return AppContext::isActiveWidget(widgetCursor);
return false;
}

int PsuAppContext::getMainPageId() {
Expand Down Expand Up @@ -1493,7 +1493,7 @@ using namespace psu::gui;

void setFocusCursor(const WidgetCursor &widgetCursor, int16_t dataId) {
g_setFocusCursor = true;
g_focusCursorToSet = widgetCursor;
g_focusCursorToSet = widgetCursor;
g_focusDataIdToSet = dataId;
}

Expand Down Expand Up @@ -1856,7 +1856,7 @@ void takeScreenshot() {
////////////////////////////////////////////////////////////////////////////////

static int g_findNextFocusCursorState = 0;
static WidgetCursor g_nextFocusCursor = Cursor(0);
static WidgetCursor g_nextFocusCursor = 0;
static uint16_t g_nextFocusDataId = DATA_ID_CHANNEL_U_EDIT;

bool findNextFocusCursor(const WidgetCursor &widgetCursor) {
Expand Down Expand Up @@ -1931,10 +1931,6 @@ void onEncoder(int counter, bool clicked) {
Page *activePage = getActivePage();

if (counter != 0) {
if (!isEnabledFocusCursor(g_focusCursor, g_focusDataId)) {
moveToNextFocusCursor();
}

#if defined(EEZ_PLATFORM_SIMULATOR)
if (g_focusCursorAction == ACTION_ID_SCROLL) {
counter = -counter;
Expand Down
2 changes: 1 addition & 1 deletion src/bb3/tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ EEZ_MESSAGE_QUEUE_DECLARE(highPriority, {

void lowPriorityThreadMainLoop(void *);

EEZ_THREAD_DECLARE(lowPriority, Normal, 8192);
EEZ_THREAD_DECLARE(lowPriority, Normal, 12288);

EEZ_MESSAGE_QUEUE_DECLARE(lowPriority, {
LowPriorityThreadMessage type;
Expand Down
70 changes: 33 additions & 37 deletions src/eez/gui/app_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,53 +308,49 @@ void AppContext::onPageTouch(const WidgetCursor &foundWidget, Event &touchEvent)
////////////////////////////////////////////////////////////////////////////////

void AppContext::updatePage(int i, WidgetCursor &widgetCursor) {
if (!isPageFullyCovered(i)) {
if (!widgetCursor.previousState || m_pageNavigationStack[i].displayBufferIndex == -1) {
m_pageNavigationStack[i].displayBufferIndex = display::allocBuffer();
widgetCursor.previousState = nullptr;
}
if (!widgetCursor.previousState || m_pageNavigationStack[i].displayBufferIndex == -1) {
m_pageNavigationStack[i].displayBufferIndex = display::allocBuffer();
widgetCursor.previousState = nullptr;
}

display::selectBuffer(m_pageNavigationStack[i].displayBufferIndex);
display::selectBuffer(m_pageNavigationStack[i].displayBufferIndex);

m_updatePageIndex = i;
m_updatePageIndex = i;

int x;
int y;
int width;
int height;
bool withShadow;
int x;
int y;
int width;
int height;
bool withShadow;

if (isPageInternal(m_pageNavigationStack[i].pageId)) {
auto internalPage = ((InternalPage *)m_pageNavigationStack[i].page);
x = internalPage->x;
y = internalPage->y;
width = internalPage->width;
height = internalPage->height;
withShadow = true;
if (isPageInternal(m_pageNavigationStack[i].pageId)) {
auto internalPage = ((InternalPage *)m_pageNavigationStack[i].page);

x = internalPage->x;
y = internalPage->y;
width = internalPage->width;
height = internalPage->height;
withShadow = true;

internalPage->updateInternalPage(widgetCursor);
internalPage->updateInternalPage(widgetCursor);

enumNoneWidget(widgetCursor);
} else {
auto page = getPageAsset(m_pageNavigationStack[i].pageId, widgetCursor);
enumNoneWidget(widgetCursor);
} else {
auto page = getPageAsset(m_pageNavigationStack[i].pageId, widgetCursor);

x = widgetCursor.x + page->x;
y = widgetCursor.y + page->y;
width = page->w;
height = page->h;
withShadow = page->x > 0;
x = widgetCursor.x + page->x;
y = widgetCursor.y + page->y;
width = page->w;
height = page->h;
withShadow = page->x > 0;

widgetCursor.widget = page;
enumWidget(widgetCursor);
}
widgetCursor.widget = page;
enumWidget(widgetCursor);
}

display::setBufferBounds(m_pageNavigationStack[i].displayBufferIndex, x, y, width, height, withShadow, 255, 0, 0, withShadow && activePageHasBackdropHook() ? &rect : nullptr);
display::setBufferBounds(m_pageNavigationStack[i].displayBufferIndex, x, y, width, height, withShadow, 255, 0, 0, withShadow && activePageHasBackdropHook() ? &rect : nullptr);

m_updatePageIndex = -1;
} else {
m_pageNavigationStack[i].displayBufferIndex = -1;
}
m_updatePageIndex = -1;
}

bool isRect1FullyCoveredByRect2(int xRect1, int yRect1, int wRect1, int hRect1, int xRect2, int yRect2, int wRect2, int hRect2) {
Expand Down
Loading

0 comments on commit aabbbb8

Please sign in to comment.