Skip to content

Commit

Permalink
Minor cleanup (#2909)
Browse files Browse the repository at this point in the history
  • Loading branch information
digant73 committed Mar 8, 2024
1 parent 6e72257 commit bf3305a
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 52 deletions.
6 changes: 3 additions & 3 deletions TFT/src/User/API/Mainboard_AckHandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -831,11 +831,11 @@ void parseAck(void)

sprintf(tmpMsg, "Mean: %0.5f", ack_value());

if (ack_continue_seen("Min: "))
if (ack_continue_seen("Min:"))
sprintf(strchr(tmpMsg, '\0'), "\nMin: %0.5f", ack_value());
if (ack_continue_seen("Max: "))
if (ack_continue_seen("Max:"))
sprintf(strchr(tmpMsg, '\0'), "\nMax: %0.5f", ack_value());
if (ack_continue_seen("Range: "))
if (ack_continue_seen("Range:"))
sprintf(strchr(tmpMsg, '\0'), "\nRange: %0.5f", ack_value());

popupReminder(DIALOG_TYPE_INFO, (uint8_t *)"Repeatability Test", (uint8_t *)tmpMsg);
Expand Down
23 changes: 11 additions & 12 deletions TFT/src/User/API/Settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
SETTINGS infoSettings;
MACHINE_SETTINGS infoMachineSettings;

const uint8_t default_serial_port[] = {SP_1, SP_2, SP_3, SP_4};
const uint16_t default_max_temp[] = MAX_TEMP;
const uint16_t default_max_fan[] = FAN_MAX;
const uint16_t default_size_min[] = {X_MIN_POS, Y_MIN_POS, Z_MIN_POS};
const uint16_t default_size_max[] = {X_MAX_POS, Y_MAX_POS, Z_MAX_POS};
const uint16_t default_xy_speed[] = {SPEED_XY_SLOW, SPEED_XY_NORMAL, SPEED_XY_FAST};
const uint16_t default_z_speed[] = {SPEED_Z_SLOW, SPEED_Z_NORMAL, SPEED_Z_FAST};
const uint16_t default_ext_speed[] = {EXTRUDE_SLOW_SPEED, EXTRUDE_NORMAL_SPEED, EXTRUDE_FAST_SPEED};
const uint16_t default_pause_speed[] = {NOZZLE_PAUSE_XY_FEEDRATE, NOZZLE_PAUSE_Z_FEEDRATE, NOZZLE_PAUSE_E_FEEDRATE};
const uint16_t default_level_speed[] = {LEVELING_XY_FEEDRATE, LEVELING_Z_FEEDRATE};
const uint8_t default_led_color[] = {LED_R, LED_G, LED_B, LED_W, LED_P, LED_I};
const uint8_t default_custom_enabled[] = CUSTOM_GCODE_ENABLED;
const uint8_t default_serial_port[] = {SP_1, SP_2, SP_3, SP_4};
const uint16_t default_max_temp[] = MAX_TEMP;
const uint16_t default_max_fan[] = FAN_MAX;
const uint16_t default_size_min[] = {X_MIN_POS, Y_MIN_POS, Z_MIN_POS};
const uint16_t default_size_max[] = {X_MAX_POS, Y_MAX_POS, Z_MAX_POS};
const uint16_t default_xy_speed[] = {SPEED_XY_SLOW, SPEED_XY_NORMAL, SPEED_XY_FAST};
const uint16_t default_z_speed[] = {SPEED_Z_SLOW, SPEED_Z_NORMAL, SPEED_Z_FAST};
const uint16_t default_ext_speed[] = {EXTRUDE_SLOW_SPEED, EXTRUDE_NORMAL_SPEED, EXTRUDE_FAST_SPEED};
const uint16_t default_pause_speed[] = {NOZZLE_PAUSE_XY_FEEDRATE, NOZZLE_PAUSE_Z_FEEDRATE, NOZZLE_PAUSE_E_FEEDRATE};
const uint16_t default_level_speed[] = {LEVELING_XY_FEEDRATE, LEVELING_Z_FEEDRATE};
const uint8_t default_led_color[] = {LED_R, LED_G, LED_B, LED_W, LED_P, LED_I};

// Init settings data with default values
void initSettings(void)
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern "C" {
#define STRINGS_STORE_MAX_SIZE 0x1000 // label strings max size
#define PREHEAT_STORE_MAX_SIZE 0x1000 // preheat setting max size
#define PRINT_GCODES_MAX_SIZE 0x5000 // start/end/cancel gcodes max size
#define CUSTOM_GCODE_MAX_SIZE 0x5000 // custom gocdes max size
#define CUSTOM_GCODE_MAX_SIZE 0x5000 // custom gcodes max size
#define ICON_MAX_SIZE 0x5000
#define INFOBOX_MAX_SIZE 0xB000
#define SMALL_ICON_MAX_SIZE 0x2000
Expand Down
20 changes: 12 additions & 8 deletions TFT/src/User/API/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ const GUI_POINT pointProgressText = {BYTE_WIDTH/2-2, LCD_HEIGHT-(BYTE_HEIGHT*4)}
const char * const preheatNames[] = PREHEAT_LABELS;
const uint16_t preheatHotend[] = PREHEAT_HOTEND;
const uint16_t preheatBed[] = PREHEAT_BED;
const uint8_t cgEnabled[] = CUSTOM_GCODE_ENABLED;
const char * const cgNames[] = CUSTOM_GCODE_LABELS;
const char * const cgList[] = CUSTOM_GCODE_LIST;

Expand Down Expand Up @@ -1239,15 +1240,17 @@ void resetConfig(void)

// restore custom gcode presets
int n = 0;

for (int i = 0; i < CUSTOM_GCODES_COUNT; i++)
{
if (default_custom_enabled[i] == 1)
if (cgEnabled[i] == 1)
{
strcpy(tempCG.name[n], cgNames[i]);
strcpy(tempCG.gcode[n], cgList[i]);
n++;
}
}

tempCG.count = n;

// write restored config
Expand Down Expand Up @@ -1328,6 +1331,7 @@ bool getLangFromFile(char * rootDir)
FRESULT r = f_findfirst(&d, &f, rootDir, "language_*.ini");

f_closedir(&d);

if (r != FR_OK)
return false;

Expand Down Expand Up @@ -1355,19 +1359,19 @@ bool getLangFromFile(char * rootDir)
showError(CSTAT_FILE_INVALID);
success = false;
}
else
{ // rename file if update was successful
if (!f_file_exists(FILE_ADMIN_MODE) && f_file_exists(langpath))
{ // language exists
else // rename file if update was successful
{
if (!f_file_exists(FILE_ADMIN_MODE) && f_file_exists(langpath)) // language exists
{
char newlangpath[256];
sprintf(newlangpath, "%s/%s.CUR", rootDir, f.fname);

if (f_file_exists(newlangpath))
{ // old language also exists
if (f_file_exists(newlangpath)) // old language also exists
f_unlink(newlangpath);
}

f_rename(langpath, newlangpath);
}
}

return success;
}
2 changes: 1 addition & 1 deletion TFT/src/User/Fatfs/myfatfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static inline bool compareFile(char * name1, uint32_t date1, char * name2, uint3
/**
* sort file list
*/
void sortFile(uint16_t fileCount, TCHAR * fileName[], uint32_t fileDate[])
static void sortFile(uint16_t fileCount, TCHAR * fileName[], uint32_t fileDate[])
{
for (int i = 1; i < fileCount; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/ABL.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void ablUpdateStatus(bool succeeded)
}
}

// Start ABL process
// start ABL process
void ablStart(void)
{
storeCmd("G28\n");
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/ABL.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extern "C" {
// called by parseAck() to notify ABL process status
void ablUpdateStatus(bool succeeded);

// Start ABL process
// start ABL process
void ablStart(void);

void menuUBLSave(void);
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/CaseLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ extern "C" {
#include <stdbool.h>
#include <stdint.h>

void menuCaseLight(void);
void caseLightSetPercent(uint8_t brightness);
void caseLightSetState(bool state);
void menuCaseLight(void);

#ifdef __cplusplus
}
Expand Down
1 change: 1 addition & 0 deletions TFT/src/User/Menu/Heat.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extern "C" {
* index == -2 to set the last used bed index
*/
void heatSetCurrentIndex(uint8_t index);

void menuHeat(void);

#ifdef __cplusplus
Expand Down
18 changes: 6 additions & 12 deletions TFT/src/User/Menu/MeshValid.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,12 @@ void menuMeshValid(void)
key_num = menuKeyGetValue();
switch (key_num)
{
// MESHVALID PLA
case KEY_ICON_0:
// MESHVALID PETG
case KEY_ICON_1:
// MESHVALID ABS
case KEY_ICON_2:
// MESHVALID WOOD
case KEY_ICON_3:
// MESHVALID TPU
case KEY_ICON_4:
// MESHVALID NYLON
case KEY_ICON_5:
case KEY_ICON_0: // MESHVALID PLA
case KEY_ICON_1: // MESHVALID PETG
case KEY_ICON_2: // MESHVALID ABS
case KEY_ICON_3: // MESHVALID WOOD
case KEY_ICON_4: // MESHVALID TPU
case KEY_ICON_5: // MESHVALID NYLON
mustStoreCmd("G28\n");
mustStoreCmd("G26 H%u B%u R99\n", preheatStore.preheat_hotend[key_num], preheatStore.preheat_bed[key_num]);
mustStoreCmd("G1 Z10 F%d\n", infoSettings.level_feedrate[FEEDRATE_Z]);
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/Move.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define X_MOVE_GCODE "G0 X%.2f F%d\n" // X axis gcode
#define Y_MOVE_GCODE "G0 Y%.2f F%d\n" // Y axis gcode
#define Z_MOVE_GCODE "G0 Z%.2f F%d\n" // Z axis gcode
#define GANTRY_REFRESH_TIME 500 // 1 seconds is 1000
#define GANTRY_REFRESH_TIME 500 // 1 second is 1000

#ifdef PORTRAIT_MODE
#define OFFSET 0
Expand Down
2 changes: 2 additions & 0 deletions TFT/src/User/Menu/PreheatMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ extern "C" {
#include <stdint.h>
#include "Settings.h"

// called by menuMeshValid()
void refreshPreheatIcon(PREHEAT_STORE * preheatStore, uint8_t index, bool redrawIcon);

void menuPreheat(void);

#ifdef __cplusplus
Expand Down
8 changes: 4 additions & 4 deletions TFT/src/User/Menu/Print.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void normalNameDisp(const GUI_RECT * rect, uint8_t * name)
// - icon mode menu is an option available only for browsing files from TFT SD card / TFT USB disk.
// It is not available for browsing files from onboard media
// - only short (not long) folder names and filenames are available browsing files from TFT SD card / TFT USB disk
static inline void gocdeIconDraw(void)
static inline void gcodeIconDraw(void)
{
ITEM curItem = {ICON_NULL, LABEL_NULL};
uint8_t baseIndex = infoFile.curPage * NUM_PER_PAGE;
Expand Down Expand Up @@ -118,7 +118,7 @@ static inline void gocdeIconDraw(void)
}

// update items in list mode
void gocdeListDraw(LISTITEM * item, uint16_t index, uint8_t itemPos)
void gcodeListDraw(LISTITEM * item, uint16_t index, uint8_t itemPos)
{
if (index < infoFile.folderCount) // folder
{
Expand Down Expand Up @@ -329,15 +329,15 @@ void menuPrintFromSource(void)
if (list_mode != true)
{
printIconItems.title.address = (uint8_t *)infoFile.path;
gocdeIconDraw();
gcodeIconDraw();

if (update != 2) // update title only when entering/exiting to/from directory
menuDrawTitle();
}
else
{ // title bar is also drawn by listViewCreate
listViewCreate((LABEL){.address = (uint8_t *)infoFile.path}, NULL, infoFile.folderCount + infoFile.fileCount,
&infoFile.curPage, false, NULL, gocdeListDraw);
&infoFile.curPage, false, NULL, gcodeListDraw);
}

Scroll_CreatePara(&scrollLine, (uint8_t *)infoFile.path, &titleRect);
Expand Down
9 changes: 7 additions & 2 deletions TFT/src/User/Menu/Speed.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
extern "C" {
#endif

#include <stdint.h>
#include "variants.h" // for TFT70_V3_0

#ifdef TFT70_V3_0
#include <stdint.h>

void setSpeedItemIndex(uint8_t index);
#endif

void setSpeedItemIndex(uint8_t index);
void menuSpeed(void);

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Menu/Terminal.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ typedef enum
SRC_TERMINAL_COUNT
} TERMINAL_SRC;

void menuTerminal(void);
void terminalCache(const char * stream, uint16_t streamLen, SERIAL_PORT_INDEX portIndex, TERMINAL_SRC src);
void menuTerminal(void);

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions TFT/src/User/Menu/TuneExtruder.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#define ITEM_TUNE_EXTRUDER_LEN_NUM 4

#define EXTRUDE_LEN 100.0f // in mm
#define REMAINING_LEN 20.0f // in mm
#define EXTRUDE_LEN 100.0f // in mm
#define REMAINING_LEN 20.0f // in mm

static uint8_t tool_index = NOZZLE0;
static uint8_t degreeSteps_index = 1;
Expand Down
2 changes: 2 additions & 0 deletions TFT/src/User/Menu/ZOffset.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ extern "C" {

#include <stdbool.h>

// called by menuTuning()
void zOffsetSetMenu(bool probeOffset);

void menuZOffset(void);

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Variants/Resolution/TFT_480X800.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
#define STRINGS_STORE_MAX_SIZE 0x1000 // label strings max size
#define PREHEAT_STORE_MAX_SIZE 0x1000 // preheat setting max size
#define PRINT_GCODES_MAX_SIZE 0x5000 // start/end/cancel gcodes max size
#define CUSTOM_GCODE_MAX_SIZE 0x5000 // custom gocdes max size
#define CUSTOM_GCODE_MAX_SIZE 0x5000 // custom gcodes max size
#define ICON_MAX_SIZE 0xB000 // 160*140*2 = 0xAF00 (+0xB000) per button icon
#define INFOBOX_MAX_SIZE 0x19000 // 360*140*2 = 0x189C0 (+0x19000)
#define SMALL_ICON_MAX_SIZE 0x2000 // 24*24*2 = 0x480 (+0x1000) per small icon
Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/Variants/Resolution/TFT_800X480.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
#define STRINGS_STORE_MAX_SIZE 0x1000 // label strings max size
#define PREHEAT_STORE_MAX_SIZE 0x1000 // preheat setting max size
#define PRINT_GCODES_MAX_SIZE 0x5000 // start/end/cancel gcodes max size
#define CUSTOM_GCODE_MAX_SIZE 0x5000 // custom gocdes max size
#define CUSTOM_GCODE_MAX_SIZE 0x5000 // custom gcodes max size
#define ICON_MAX_SIZE 0xB000 // 160*140*2 = 0xAF00 (+0xB000) per button icon
#define INFOBOX_MAX_SIZE 0x19000 // 360*140*2 = 0x189C0 (+0x19000)
#define SMALL_ICON_MAX_SIZE 0x2000 // 24*24*2 = 0x480 (+0x1000) per small icon
Expand Down

0 comments on commit bf3305a

Please sign in to comment.