Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make WriteVariable respecting Endian #18689

Merged
merged 1 commit into from
Jul 18, 2020
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
4 changes: 4 additions & 0 deletions Marlin/src/lcd/extui/lib/dgus/DGUSDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,10 @@ void DGUSDisplay::WriteVariable(uint16_t adr, const void* values, uint8_t values
}
}

void DGUSDisplay::WriteVariable(uint16_t adr, uint16_t value) {
WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
}

void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void* values, uint8_t valueslen, bool isstr) {
const char* myvalues = static_cast<const char*>(values);
bool strend = !myvalues;
Expand Down
5 changes: 1 addition & 4 deletions Marlin/src/lcd/extui/lib/dgus/DGUSDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ class DGUSDisplay {
// Variable access.
static void WriteVariable(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false);
static void WriteVariablePGM(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false);
template<typename T>
static void WriteVariable(uint16_t adr, T value) {
WriteVariable(adr, static_cast<const void*>(&value), sizeof(T));
}
static void WriteVariable(uint16_t adr, uint16_t value);

// Until now I did not need to actively read from the display. That's why there is no ReadVariable
// (I extensively use the auto upload of the display)
Expand Down