Skip to content

Commit

Permalink
Reset config, fix screen calibration
Browse files Browse the repository at this point in the history
  • Loading branch information
suchmememanyskill committed Feb 10, 2024
1 parent 64266b1 commit d3e7eec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CYD-Klipper/src/conf/global_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

#include "lvgl.h"

#define CONFIG_VERSION 3
#define CONFIG_VERSION 4

typedef struct _GLOBAL_CONFIG {
unsigned char version;
union {
unsigned char raw;
unsigned int raw;
struct {
// Internal
bool screenCalibrated : 1;
Expand Down
8 changes: 4 additions & 4 deletions CYD-Klipper/src/core/device/ESP32-2432S028R.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ void touchscreen_calibrate(bool force)
tft.drawFastHLine(300, 230, 20, ILI9341_BLACK);
tft.drawFastVLine(310, 220, 20, ILI9341_BLACK);

int16_t xDist = 320 - 40;
int16_t yDist = 240 - 40;
int16_t xDist = 320 - 20;
int16_t yDist = 240 - 20;

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.screenCalYOffset = 20.0 - ((float)y1 * global_config.screenCalYMult);
global_config.screenCalYOffset = 10.0 - ((float)y1 * global_config.screenCalYMult);

global_config.screenCalibrated = true;
WriteGlobalConfig();
Expand Down

1 comment on commit d3e7eec

@gknops
Copy link

@gknops gknops commented on d3e7eec Feb 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Please sign in to comment.