Просмотр исходного кода

Fix DGUS write variable endianness (#18689)

yufanyufan 4 лет назад
Родитель
Сommit
6f0885a3a3
Аккаунт пользователя с таким Email не найден
2 измененных файлов: 5 добавлений и 4 удалений
  1. 4
    0
      Marlin/src/lcd/extui/lib/dgus/DGUSDisplay.cpp
  2. 1
    4
      Marlin/src/lcd/extui/lib/dgus/DGUSDisplay.h

+ 4
- 0
Marlin/src/lcd/extui/lib/dgus/DGUSDisplay.cpp Просмотреть файл

1180
   }
1180
   }
1181
 }
1181
 }
1182
 
1182
 
1183
+void DGUSDisplay::WriteVariable(uint16_t adr, uint16_t value) {
1184
+  WriteVariable(adr, static_cast<const void*>(&value), sizeof(uint16_t));
1185
+}
1186
+
1183
 void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void* values, uint8_t valueslen, bool isstr) {
1187
 void DGUSDisplay::WriteVariablePGM(uint16_t adr, const void* values, uint8_t valueslen, bool isstr) {
1184
   const char* myvalues = static_cast<const char*>(values);
1188
   const char* myvalues = static_cast<const char*>(values);
1185
   bool strend = !myvalues;
1189
   bool strend = !myvalues;

+ 1
- 4
Marlin/src/lcd/extui/lib/dgus/DGUSDisplay.h Просмотреть файл

54
   // Variable access.
54
   // Variable access.
55
   static void WriteVariable(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false);
55
   static void WriteVariable(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false);
56
   static void WriteVariablePGM(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false);
56
   static void WriteVariablePGM(uint16_t adr, const void* values, uint8_t valueslen, bool isstr=false);
57
-  template<typename T>
58
-  static void WriteVariable(uint16_t adr, T value) {
59
-    WriteVariable(adr, static_cast<const void*>(&value), sizeof(T));
60
-  }
57
+  static void WriteVariable(uint16_t adr, uint16_t value);
61
 
58
 
62
   // Until now I did not need to actively read from the display. That's why there is no ReadVariable
59
   // Until now I did not need to actively read from the display. That's why there is no ReadVariable
63
   // (I extensively use the auto upload of the display)
60
   // (I extensively use the auto upload of the display)

Загрузка…
Отмена
Сохранить