Skip to content

Commit

Permalink
save/load infoSettings Struct instead of save/load every variable ind…
Browse files Browse the repository at this point in the history
…ividually, Fix Screen freezes/Click to Resume message/damaged M105 command in Marlin mode (#1468)
  • Loading branch information
guruathwal authored Jan 7, 2021
1 parent e48249c commit c367983
Show file tree
Hide file tree
Showing 35 changed files with 369 additions and 684 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Copy to SD Card root directory to update/MKSTFT28.bin
Binary file not shown.
Binary file modified Copy to SD Card root directory to update/MKS_32_V1_4.26.x.bin
Binary file not shown.
Empty file modified Copy to SD Card root directory to update/config.ini
100755 → 100644
Empty file.
6 changes: 3 additions & 3 deletions TFT/src/User/API/BabystepControl.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ float babystepResetValue(void)
if (babystep_value < 0.0f)
neg = -1;

step_count = (babystep_value * neg) / BABYSTEP_MAX_UNIT;
step_count = (babystep_value * neg) / BABYSTEP_MAX_STEP;
for (; step_count > 0; step_count--)
{
mustStoreCmd("M290 Z%.2f\n", -(BABYSTEP_MAX_UNIT * neg));
processed_baby_step += BABYSTEP_MAX_UNIT;
mustStoreCmd("M290 Z%.2f\n", -(BABYSTEP_MAX_STEP * neg));
processed_baby_step += BABYSTEP_MAX_STEP;
}

last_unit = (babystep_value * neg) - processed_baby_step;
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/Settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void infoSettingsReset(void)
infoSettings.m27_refresh_time = M27_REFRESH;
infoSettings.m27_active = M27_WATCH_OTHER_SOURCES;
infoSettings.longFileName = AUTO; //ENABLED / DISABLED / AUTO
infoSettings.fan_percentage = ENABLED;
infoSettings.fan_percentage = SHOW_FAN_PERCENTAGE;

infoSettings.pause_retract_len = NOZZLE_PAUSE_RETRACT_LENGTH;
infoSettings.resume_purge_len = NOZZLE_RESUME_PURGE_LENGTH;
Expand Down
6 changes: 4 additions & 2 deletions TFT/src/User/API/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ typedef enum

// Config version support
// change if new elements/keywords are added/removed/changed in the configuration.h Format YYYYMMDD
// this number should match the CONFIG_VERSION in configuration.h
#define CONFIG_SUPPPORT 20201218
// this number should match CONFIG_VERSION in configuration.h
#define CONFIG_SUPPPORT 20210105

#define FONT_FLASH_SIGN 20200908 //(YYYYMMDD) change if fonts require updating
#define CONFIG_FLASH_SIGN 20201221 //(YYYYMMDD) change if any keyword(s) in config.ini is added or removed
Expand Down Expand Up @@ -63,6 +63,8 @@ typedef enum
#define DISABLED 0
#define ENABLED 1
#define AUTO 2
#define HIGH 1
#define LOW 0

typedef enum
{
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/Temperature.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const char *const heatWaitCmd[MAX_HEATER_COUNT] = HEAT_WAIT_CMD;

static HEATER heater = {{}, NOZZLE0};
static int16_t lastTarget[MAX_HEATER_COUNT] = {0};
static uint8_t heat_update_seconds = 0;
static uint8_t heat_update_seconds = TEMPERATURE_QUERY_SLOW_SECONDS;
static bool heat_update_waiting = false;
static bool heat_send_waiting[MAX_HEATER_COUNT];

Expand Down
295 changes: 19 additions & 276 deletions TFT/src/User/API/flashStore.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion TFT/src/User/API/flashStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern "C" {
#include "variants.h"
#include "Settings.h"

#define PARA_SIZE 768 //bytes
#define PARA_SIZE 256 // Max size of settings buffer to read/write

void readStoredPara(void);
void storePara(void);
Expand Down
20 changes: 10 additions & 10 deletions TFT/src/User/API/parseACK.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,26 +287,25 @@ void parseACK(void)
syncL2CacheFromL1(SERIAL_PORT);
infoHost.rx_ok[SERIAL_PORT] = false;

if (infoHost.connected == false) //not connected to Marlin
if (infoHost.connected == false) // Not connected to printer
{
// Parse error information even though not connected to printer
if (ack_seen(errormagic))
{
ackPopupInfo(errormagic);
}
if (ack_seen(errormagic)) ackPopupInfo(errormagic);

//the first response should be such as "T:25/50\n"
if (!(ack_seen("@") && ack_seen("T:")) && !ack_seen("T0:")) goto parse_end;
if (ack_seen(heaterID[BED])) infoSettings.bed_en = ENABLED;
if (ack_seen(heaterID[CHAMBER])) infoSettings.chamber_en = ENABLED;
if (!(ack_seen("@") && ack_seen("T:")) && !ack_seen("T0:")) goto parse_end;

// find hotend count and setup heaters
uint8_t i;
for (i = NOZZLE0; i < MAX_HOTEND_COUNT; i++)
{
if(!ack_seen(heaterID[i])) break;
}
infoSettings.hotend_count = i ? i : 1;
if (infoSettings.ext_count < infoSettings.hotend_count) infoSettings.ext_count = infoSettings.hotend_count;
if (ack_seen(heaterID[BED])) infoSettings.bed_en = ENABLED;
if (ack_seen(heaterID[CHAMBER])) infoSettings.chamber_en = ENABLED;
updateNextHeatCheckTime();
infoHost.connected = true;

#ifdef RepRapFirmware
if (!ack_seen("@")) //It's RepRapFirmware
Expand All @@ -323,10 +322,11 @@ void parseACK(void)
{
storeCmd("M503\n"); // Query detailed printer capabilities
storeCmd("M92\n"); // Steps/mm of extruder is an important parameter for Smart filament runout
// Avoid can't getting this parameter due to disabled M503 in Marlin
// Avoid can't getting this parameter due to disabled M503 in Marlin
storeCmd("M115\n");
storeCmd("M211\n"); // retrieve the software endstops state
}
infoHost.connected = true;
}

// Onboard sd Gcode command response
Expand Down
Loading

0 comments on commit c367983

Please sign in to comment.