Skip to content

Commit

Permalink
Optimized parsing in interfaceCmd.c and parseACK.c + configurable M10…
Browse files Browse the repository at this point in the history
…9/M190 (bigtreetech#2156)
  • Loading branch information
digant73 committed Sep 9, 2021
1 parent 93adb6e commit 0f89ae5
Show file tree
Hide file tree
Showing 67 changed files with 875 additions and 684 deletions.
67 changes: 39 additions & 28 deletions Copy to SD Card root directory to update/config.ini
Expand Up @@ -97,23 +97,34 @@ serial_port:P1:6 P2:0 P3:0 P4:0
# The TFT intercepts the M600 gcode (filament change) and emulates the handling logic
# otherwise provided by Marlin firmware.
#
# NOTE: Enable it, in case Marlin firmware does not properly support M600 on the mainboard.
# NOTE: Enable it in case Marlin firmware does not properly support M600 on the mainboard.
#
# Options: [disable: 0, enable: 1]
emulated_m600:1

#### Emulated M109 And M190
# The TFT intercepts the blocking M109 and M190 gcodes (set target hotend and bed temperatures)
# and converts them to the non blocking M104 and M140 gcodes respectively.
#
# NOTE: Enable it so the TFT can still communicate with Marlin firmware even if the target
# temperature is not reached yet. Otherwise the communication (TFT<->Marlin) will be
# frozen until desired/set temperatures are obtained.
#
# Options: [disable: 0, enable: 1]
emulated_m109_m190:1


#--------------------------------------------------------------------
# UI Settings
#--------------------------------------------------------------------

#### Rotate UI
#### Rotated UI
# Rotate UI by 180 degrees.
# Options: [disable: 0, enable: 1]
rotate_ui:0
rotated_ui:0

#### Default Touch Mode Language
# Select the language to display on the LCD while in Touch Mode.
#### Touch Mode Language
# Select the language to use on the LCD while in Touch Mode.
#
# NOTE: To add/flash a second language copy the required "language_xx.ini" file from
# "Language Packs" folder to the SD root folder.
Expand All @@ -133,7 +144,7 @@ language:0
# Options: [disable: 0, enable: 1]
status_screen:1

#### Default Touch Mode Colors
#### Touch Mode Colors
# Set colors used in Touch Mode.
#
# NOTE: Select an option from the provided list or set the color (RGB888 format) hex value directly
Expand Down Expand Up @@ -285,7 +296,7 @@ default_mode:1
# Options: [disable: 0, enable: 1]
serial_always_on:0

#### Default Marlin Mode Background & Font Colors
#### Marlin Mode Background & Font Colors
# Set colors used in Marlin Mode.
#
# NOTE: Select an option from the provided list or set the color (RGB888 format) hex value directly
Expand Down Expand Up @@ -385,21 +396,21 @@ fan_max:F0:255 F1:255 F2:255 F3:255 F4:255 F5:255 CtL:255 CtI:255
size_min:X0 Y0 Z0
size_max:X235 Y235 Z250

#### Default X & Y Move Speeds/Feedrates
#### X & Y Move Speeds/Feedrates
# Move speeds used in Move menu to move X and Y axes.
# Format: [move_speed: S<feedrate> N<feedrate> F<feedrate>]
# Unit: [feedrate in mm/min]
# Value range: [min: 10, max: 12000]
xy_speed:S1000 N3000 F5000

#### Default Z Speeds/Feedrates
#### Z Speeds/Feedrates
# Move speeds used in Move menu to move Z axis.
# Format: [move_speed: S<feedrate> N<feedrate> F<feedrate>]
# Unit: [feedrate in mm/min]
# Value range: [min: 10, max: 12000]
z_speed:S500 N1000 F2000

#### Default Extruder Speeds/Feedrates
#### Extruder Speeds/Feedrates
# Speed settings used to extrude/retract.
# Format: [ext_speed: S<feedrate> N<feedrate> F<feedrate>]
# Unit: [feedrate in mm/min]
Expand Down Expand Up @@ -593,7 +604,7 @@ preheat_temp_6:T250 B90
# Options: [disable: 0, enable: 1]
ps_active_high:1

#### Default Power Supply Auto Shutdown Mode
#### Power Supply Auto Shutdown Mode
# Used in case it is supported by the TFT.
# Enable power supply auto shutdown after a print is finished when hotend temperature drops below target value.
# Options: [disable: 0, enable: 1, auto-detect: 2]
Expand All @@ -618,7 +629,7 @@ ps_auto_shutdown_temp:50
# 2) Configure the sensor in the firmware of your mainboard.
# 3) Add M75 to "start_gcode" and M77 to "end_gcode" of the TFT (or your slicer).

#### Default Filament Runout Sensor
#### Filament Runout Sensor
# Select the type of filament runout sensor and its default enabled/disabled state.
#
# Options: [Normal Disabled: 0, Normal Enabled: 1, Smart Disabled: 2, Smart Enabled: 3]
Expand Down Expand Up @@ -652,7 +663,7 @@ fil_runout_distance:7
# Power Loss Recovery & BTT UPS Settings
#--------------------------------------------------------------------

#### Default Power Loss Recovery Mode
#### Power Loss Recovery Mode
# Enable power loss recovery.
# Disable to reduce the loss of SD card or U disk.
# Options: [disable: 0, enable: 1]
Expand Down Expand Up @@ -698,40 +709,40 @@ toast_sound:1
alert_sound:1
heater_sound:1

#### Default LCD Brightness Levels (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# Default brightness values for LCD.
#### LCD Brightness Levels (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# Brightness levels for LCD.
# Options: [OFF: 0, 5%: 1, 10%: 2, 20%: 3, 30%: 4, 40%: 5, 50%: 6, 60%: 7, 70%: 8, 80%: 9, 90%: 10, 100%: 11]

## Default display brightness
## LCD brightness level
lcd_brightness:11

## Display brightness when device is idle
## LCD brightness level when device is idle
lcd_idle_brightness:5

#### Default LCD Idle Time (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
#### LCD Idle Time (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# The LCD screen will dim to idle brightness, if the display is not touched for the
# period of the LCD idle time.
# Options: [OFF: 0, 5sec: 1, 10sec: 2, 30sec: 3, 1min: 4, 2min: 5, 5min: 6, 10min: 7]
lcd_idle_time:4

#### Block Touch On Idle (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# If enabled, when the LCD is on idle (dimmed) then the first touch on the display will
#### LCD Lock On Idle (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# If enabled, when the LCD is idle (dimmed) then the first touch on the display will
# simply restore the normal LCD brightness. The touch is then skipped, preventing to
# trigger any undesired action due to the dimmed display.
#
# NOTE: The block is always avoided if the LCD brightness is restored by the use of
# rotary encoder instead of pressing on the display.
# NOTE: The lock is always avoided if the LCD brightness is restored by the use of
# rotary encoder instead of touching the display.
#
# Options: [disable: 0, enable: 1]
block_touch_on_idle:0
lcd_lock_on_idle:0

#### Knob LED Color (only for TFT28/TFT35_E3/TFT43/TFT50/TFT70 V3.0)
# Knob LED color at startup.
# Options: [OFF: 0, WHITE: 1, RED: 2, ORANGE: 3, YELLOW: 4, GREEN: 5, BLUE: 6, INDIGO: 7, VIOLET: 8]
knob_led_color:0

#### Knob Idle State (only for TFT28/TFT35_E3/TFT43/TFT50/TFT70 V3.0)
# If enabled, when the LCD is on idle (dimmed) then the knob LED will be also switched off.
#### Knob LED Idle State (only for TFT28/TFT35_E3/TFT43/TFT50/TFT70 V3.0)
# If enabled, when the LCD is idle (dimmed) then the knob LED will be also switched off.
# Options: [disable: 0, enable: 1]
knob_led_idle:1

Expand Down Expand Up @@ -800,15 +811,15 @@ custom_gcode_7:M502\n
# - start_gcode: M75\n
# - end_gcode: M77\n

#### Default Start Gcode Status
#### Start Gcode Status
# Options: [disable: 0, enable: 1]
start_gcode_enabled:0

#### Default End Gcode Status
#### End Gcode Status
# Options: [disable: 0, enable: 1]
end_gcode_enabled:0

#### Default Cancel Gcode Status
#### Cancel Gcode Status
# Options: [disable: 0, enable: 1]
cancel_gcode_enabled:0

Expand Down
70 changes: 41 additions & 29 deletions Copy to SD Card root directory to update/config_rrf.ini
Expand Up @@ -55,8 +55,9 @@
#Add the following line in your cancel.g file to allow the screen to know when a job has been cancelled.
#
#M118 P2 S"//action::prompt_begin Resuming"
#
#In case you need help, please visit: https://discord.com/invite/uS97Qs7 or https://teamgloomy.github.io/

In case you need help, please visit: https://discord.com/invite/uS97Qs7 or https://teamgloomy.github.io/

#--------------------------------------------------------------------
# General Settings
Expand Down Expand Up @@ -91,23 +92,34 @@ serial_port:P1:5 P2:0 P3:0 P4:0
# The TFT intercepts the M600 gcode (filament change) and emulates the handling logic
# otherwise provided by Marlin firmware.
#
# NOTE: Enable it, in case Marlin firmware does not properly support M600 on the mainboard.
# NOTE: Enable it in case Marlin firmware does not properly support M600 on the mainboard.
#
# Options: [disable: 0, enable: 1]
emulated_m600:1

#### Emulated M109 And M190
# The TFT intercepts the blocking M109 and M190 gcodes (set target hotend and bed temperatures)
# and converts them to the non blocking M104 and M140 gcodes respectively.
#
# NOTE: Enable it so the TFT can still communicate with Marlin firmware even if the target
# temperature is not reached yet. Otherwise the communication (TFT<->Marlin) will be
# frozen until desired/set temperatures are obtained.
#
# Options: [disable: 0, enable: 1]
emulated_m109_m190:1


#--------------------------------------------------------------------
# UI Settings
#--------------------------------------------------------------------

#### Rotate UI
#### Rotated UI
# Rotate UI by 180 degrees.
# Options: [disable: 0, enable: 1]
rotate_ui:0
rotated_ui:0

#### Default Touch Mode Language
# Select the language to display on the LCD while in Touch Mode.
#### Touch Mode Language
# Select the language to use on the LCD while in Touch Mode.
#
# NOTE: To add/flash a second language copy the required "language_xx.ini" file from
# "Language Packs" folder to the SD root folder.
Expand All @@ -127,7 +139,7 @@ language:0
# Options: [disable: 0, enable: 1]
status_screen:1

#### Default Touch Mode Colors
#### Touch Mode Colors
# Set colors used in Touch Mode.
#
# NOTE: Select an option from the provided list or set the color (RGB888 format) hex value directly
Expand Down Expand Up @@ -279,7 +291,7 @@ default_mode:1
# Options: [disable: 0, enable: 1]
serial_always_on:1

#### Default Marlin Mode Background & Font Colors
#### Marlin Mode Background & Font Colors
# Set colors used in Marlin Mode.
#
# NOTE: Select an option from the provided list or set the color (RGB888 format) hex value directly
Expand Down Expand Up @@ -379,21 +391,21 @@ fan_max:F0:255 F1:255 F2:255 F3:255 F4:255 F5:255 CtL:255 CtI:255
size_min:X0 Y0 Z0
size_max:X235 Y235 Z250

#### Default X & Y Move Speeds/Feedrates
#### X & Y Move Speeds/Feedrates
# Move speeds used in Move menu to move X and Y axes.
# Format: [move_speed: S<feedrate> N<feedrate> F<feedrate>]
# Unit: [feedrate in mm/min]
# Value range: [min: 10, max: 12000]
xy_speed:S1000 N3000 F5000

#### Default Z Speeds/Feedrates
#### Z Speeds/Feedrates
# Move speeds used in Move menu to move Z axis.
# Format: [move_speed: S<feedrate> N<feedrate> F<feedrate>]
# Unit: [feedrate in mm/min]
# Value range: [min: 10, max: 12000]
z_speed:S500 N1000 F2000

#### Default Extruder Speeds/Feedrates
#### Extruder Speeds/Feedrates
# Speed settings used to extrude/retract.
# Format: [ext_speed: S<feedrate> N<feedrate> F<feedrate>]
# Unit: [feedrate in mm/min]
Expand Down Expand Up @@ -587,7 +599,7 @@ preheat_temp_6:T250 B90
# Options: [disable: 0, enable: 1]
ps_active_high:1

#### Default Power Supply Auto Shutdown Mode
#### Power Supply Auto Shutdown Mode
# Used in case it is supported by the TFT.
# Enable power supply auto shutdown after a print is finished when hotend temperature drops below target value.
# Options: [disable: 0, enable: 1, auto-detect: 2]
Expand All @@ -612,7 +624,7 @@ ps_auto_shutdown_temp:50
# 2) Configure the sensor in the firmware of your mainboard.
# 3) Add M75 to "start_gcode" and M77 to "end_gcode" of the TFT (or your slicer).

#### Default Filament Runout Sensor
#### Filament Runout Sensor
# Select the type of filament runout sensor and its default enabled/disabled state.
#
# Options: [Normal Disabled: 0, Normal Enabled: 1, Smart Disabled: 2, Smart Enabled: 3]
Expand Down Expand Up @@ -646,7 +658,7 @@ fil_runout_distance:7
# Power Loss Recovery & BTT UPS Settings
#--------------------------------------------------------------------

#### Default Power Loss Recovery Mode
#### Power Loss Recovery Mode
# Enable power loss recovery.
# Disable to reduce the loss of SD card or U disk.
# Options: [disable: 0, enable: 1]
Expand Down Expand Up @@ -692,40 +704,40 @@ toast_sound:1
alert_sound:1
heater_sound:1

#### Default LCD Brightness Levels (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# Default brightness values for LCD.
#### LCD Brightness Levels (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# Brightness levels for LCD.
# Options: [OFF: 0, 5%: 1, 10%: 2, 20%: 3, 30%: 4, 40%: 5, 50%: 6, 60%: 7, 70%: 8, 80%: 9, 90%: 10, 100%: 11]

## Default display brightness
## LCD brightness level
lcd_brightness:11

## Display brightness when device is idle
## LCD brightness level when device is idle
lcd_idle_brightness:5

#### Default LCD Idle Time (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
#### LCD Idle Time (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# The LCD screen will dim to idle brightness, if the display is not touched for the
# period of the LCD idle time.
# Options: [OFF: 0, 5sec: 1, 10sec: 2, 30sec: 3, 1min: 4, 2min: 5, 5min: 6, 10min: 7]
lcd_idle_time:4

#### Block Touch On Idle (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# If enabled, when the LCD is on idle (dimmed) then the first touch on the display will
#### LCD Lock On Idle (only for TFT28/TFT35/TFT43/TFT50/TFT70 V3.0)
# If enabled, when the LCD is idle (dimmed) then the first touch on the display will
# simply restore the normal LCD brightness. The touch is then skipped, preventing to
# trigger any undesired action due to the dimmed display.
#
# NOTE: The block is always avoided if the LCD brightness is restored by the use of
# rotary encoder instead of pressing on the display.
# NOTE: The lock is always avoided if the LCD brightness is restored by the use of
# rotary encoder instead of touching the display.
#
# Options: [disable: 0, enable: 1]
block_touch_on_idle:0
lcd_lock_on_idle:0

#### Knob LED Color (only for TFT28/TFT35_E3/TFT43/TFT50/TFT70 V3.0)
# Knob LED color at startup.
# Options: [OFF: 0, WHITE: 1, RED: 2, ORANGE: 3, YELLOW: 4, GREEN: 5, BLUE: 6, INDIGO: 7, VIOLET: 8]
knob_led_color:0

#### Knob Idle State (only for TFT28/TFT35_E3/TFT43/TFT50/TFT70 V3.0)
# If enabled, when the LCD is on idle (dimmed) then the knob LED will be also switched off.
#### Knob LED Idle State (only for TFT28/TFT35_E3/TFT43/TFT50/TFT70 V3.0)
# If enabled, when the LCD is idle (dimmed) then the knob LED will be also switched off.
# Options: [disable: 0, enable: 1]
knob_led_idle:1

Expand Down Expand Up @@ -794,15 +806,15 @@ custom_gcode_7:M502\n
# - start_gcode: M75\n
# - end_gcode: M77\n

#### Default Start Gcode Status
#### Start Gcode Status
# Options: [disable: 0, enable: 1]
start_gcode_enabled:0

#### Default End Gcode Status
#### End Gcode Status
# Options: [disable: 0, enable: 1]
end_gcode_enabled:0

#### Default Cancel Gcode Status
#### Cancel Gcode Status
# Options: [disable: 0, enable: 1]
cancel_gcode_enabled:0

Expand Down
2 changes: 1 addition & 1 deletion TFT/src/User/API/FlashStore.c
Expand Up @@ -68,7 +68,7 @@ void readStoredPara(void)
else
{
memcpy(&infoSettings, data + (index += 4), sizeof(SETTINGS));
if ((paraStatus & PARA_TSC_EXIST) == 0) infoSettings.rotate_ui = DISABLED;
if ((paraStatus & PARA_TSC_EXIST) == 0) infoSettings.rotated_ui = DISABLED;
}
}

Expand Down
4 changes: 2 additions & 2 deletions TFT/src/User/API/Gcode/gcode.c
Expand Up @@ -246,8 +246,8 @@ void request_M0(void)

void request_M98(char *filename)
{
char command[CMD_MAX_CHAR];
snprintf(command, CMD_MAX_CHAR, "M98 P/%s\n", filename);
CMD command;
snprintf(command, CMD_MAX_SIZE, "M98 P/%s\n", filename);
rrfStatusSetMacroBusy();
mustStoreCmd(command);
// prevent a race condition when rrfStatusQuery returns !busy before executing the macro
Expand Down

0 comments on commit 0f89ae5

Please sign in to comment.