Support for TFT & Touch Screens (#18130)

This commit is contained in:
Alexander Gavrilenko
2020-07-30 09:43:19 +03:00
committed by GitHub
parent bba157e5bd
commit 117df87d19
176 changed files with 14747 additions and 303 deletions

View File

@ -140,6 +140,10 @@
#define HAS_CASE_LIGHT_BRIGHTNESS 1
#endif
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#include "../lcd/tft/touch.h"
#endif
#pragma pack(push, 1) // No padding between variables
typedef struct { uint16_t X, Y, Z, X2, Y2, Z2, Z3, Z4, E0, E1, E2, E3, E4, E5, E6, E7; } tmc_stepper_current_t;
@ -403,6 +407,13 @@ typedef struct SettingsDataStruct {
uint8_t case_light_brightness;
#endif
//
// TOUCH_SCREEN_CALIBRATION
//
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
touch_calibration_t touch_calibration;
#endif
} SettingsData;
//static_assert(sizeof(SettingsData) <= MARLIN_EEPROM_SIZE, "EEPROM too small to contain SettingsData!");
@ -1334,6 +1345,13 @@ void MarlinSettings::postprocess() {
EEPROM_WRITE(case_light_brightness);
#endif
//
// TOUCH_SCREEN_CALIBRATION
//
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
EEPROM_WRITE(touch.calibration);
#endif
//
// Validate CRC and Data Size
//
@ -2167,6 +2185,14 @@ void MarlinSettings::postprocess() {
EEPROM_READ(case_light_brightness);
#endif
//
// TOUCH_SCREEN_CALIBRATION
//
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
_FIELD_TEST(touch.calibration);
EEPROM_READ(touch.calibration);
#endif
eeprom_error = size_error(eeprom_index - (EEPROM_OFFSET));
if (eeprom_error) {
DEBUG_ECHO_START();
@ -2469,6 +2495,11 @@ void MarlinSettings::reset() {
//
TERN_(HAS_CASE_LIGHT_BRIGHTNESS, case_light_brightness = CASE_LIGHT_DEFAULT_BRIGHTNESS);
//
// TOUCH_SCREEN_CALIBRATION
//
TERN_(TOUCH_SCREEN_CALIBRATION, touch.calibration_reset());
//
// Magnetic Parking Extruder
//