mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-21 05:33:24 +00:00
Reset config, fix screen calibration
This commit is contained in:
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
#define CONFIG_VERSION 3
|
#define CONFIG_VERSION 4
|
||||||
|
|
||||||
typedef struct _GLOBAL_CONFIG {
|
typedef struct _GLOBAL_CONFIG {
|
||||||
unsigned char version;
|
unsigned char version;
|
||||||
union {
|
union {
|
||||||
unsigned char raw;
|
unsigned int raw;
|
||||||
struct {
|
struct {
|
||||||
// Internal
|
// Internal
|
||||||
bool screenCalibrated : 1;
|
bool screenCalibrated : 1;
|
||||||
|
|||||||
@@ -77,14 +77,14 @@ void touchscreen_calibrate(bool force)
|
|||||||
tft.drawFastHLine(300, 230, 20, ILI9341_BLACK);
|
tft.drawFastHLine(300, 230, 20, ILI9341_BLACK);
|
||||||
tft.drawFastVLine(310, 220, 20, ILI9341_BLACK);
|
tft.drawFastVLine(310, 220, 20, ILI9341_BLACK);
|
||||||
|
|
||||||
int16_t xDist = 320 - 40;
|
int16_t xDist = 320 - 20;
|
||||||
int16_t yDist = 240 - 40;
|
int16_t yDist = 240 - 20;
|
||||||
|
|
||||||
global_config.screenCalXMult = (float)xDist / (float)(x2 - x1);
|
global_config.screenCalXMult = (float)xDist / (float)(x2 - x1);
|
||||||
global_config.screenCalXOffset = 20.0 - ((float)x1 * global_config.screenCalXMult);
|
global_config.screenCalXOffset = 10.0 - ((float)x1 * global_config.screenCalXMult);
|
||||||
|
|
||||||
global_config.screenCalYMult = (float)yDist / (float)(y2 - y1);
|
global_config.screenCalYMult = (float)yDist / (float)(y2 - y1);
|
||||||
global_config.screenCalYOffset = 20.0 - ((float)y1 * global_config.screenCalYMult);
|
global_config.screenCalYOffset = 10.0 - ((float)y1 * global_config.screenCalYMult);
|
||||||
|
|
||||||
global_config.screenCalibrated = true;
|
global_config.screenCalibrated = true;
|
||||||
WriteGlobalConfig();
|
WriteGlobalConfig();
|
||||||
|
|||||||
Reference in New Issue
Block a user