Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions sources/Adapters/picoTracker/display/chargfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,12 @@ uint8_t chargfx_get_cursor_y() { return cursor_y; }
void chargfx_putc(char c, bool invert) {
int idx = cursor_y * TEXT_WIDTH + cursor_x;
if (c >= 32 && c <= 127) {
uint8_t color;
screen[idx] = c - 32;
SetBit(changed, idx);
if (invert) {
color = ((screen_bg_color & 0xf) << 4) | (screen_fg_color & 0xf);
colors[idx] = ((screen_bg_color & 0xf) << 4) | (screen_fg_color & 0xf);
} else {
color = ((screen_fg_color & 0xf) << 4) | (screen_bg_color & 0xf);
}
if (colors[idx] != color || screen[idx] != c - 32) {
screen[idx] = c - 32;
colors[idx] = color;
SetBit(changed, idx);
colors[idx] = ((screen_fg_color & 0xf) << 4) | (screen_bg_color & 0xf);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion sources/Adapters/picoTracker/gui/picoTrackerEventManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ void picoTrackerEventManager::ProcessInputEvent() {

#ifdef SERIAL_REPL
serialDebugUI_.readSerialIn(inBuffer, INPUT_BUFFER_SIZE);

#endif
#ifdef USB_REMOTE_UI
char inBuffer[16];
auto readbytes = readFromUSBCDC(inBuffer, 16);
if (readbytes > 0) {
Expand Down
8 changes: 6 additions & 2 deletions sources/Application/Views/BaseClasses/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ void View::Redraw() {
isDirty_ = false;
};

void View::SetDirty(bool isDirty) { isDirty_ = true; };
void View::SetDirty(bool isDirty) { isDirty_ = isDirty; };

void View::ProcessButton(unsigned short mask, bool pressed) {
isDirty_ = false;
Expand Down Expand Up @@ -365,7 +365,11 @@ void View::drawBattery(GUITextProperties &props) {
// only update the voltage once per second
if (AppWindow::GetAnimationFrameCounter() % 50 == 0) {
System *sys = System::GetInstance();
voltage = sys->GetBatteryLevel() / 1000.0;
auto v = sys->GetBatteryLevel() / 1000.0;
// add some hysteresis
if (abs(v - voltage) > 0.1) {
voltage = v;
}
}

GUIPoint battpos = GetAnchor();
Expand Down
12 changes: 10 additions & 2 deletions sources/Application/Views/ThemeView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,7 @@ void ThemeView::Update(Observable &o, I_ObservableData *d) {
((AppWindow &)w_).UpdateColorsFromConfig();

// Force a redraw of the entire screen to update all colors
ForceClear();
DrawView();
_forceRedraw = true;
break;
}
default:
Expand Down Expand Up @@ -486,3 +485,12 @@ void ThemeView::importTheme() {
SetChanged();
NotifyObservers(&ve);
}
void ThemeView::AnimationUpdate() {
if (_forceRedraw) {
ForceClear();
DrawView();
_forceRedraw = false;
}
GUITextProperties props;
drawBattery(props);
}
6 changes: 6 additions & 0 deletions sources/Application/Views/ThemeView.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class ThemeView : public FieldView, public I_Observer {
// Observer for action callback
void Update(Observable &, I_ObservableData *);

void AnimationUpdate() override;

// For storing export theme name during modal callbacks
etl::string<MAX_INSTRUMENT_NAME_LENGTH> exportThemeName_;

Expand All @@ -53,5 +55,9 @@ class ThemeView : public FieldView, public I_Observer {
void importTheme();
void exportThemeWithName(const char *themeName, bool overwrite);
void updateThemeNameFromConfig(); // Update the theme name field from Config

// need separate flag for force because isDirty_ won't work for this because
// it gets reset before AnimationUpdate is called in ThemeViews case
bool _forceRedraw = false;
};
#endif