Spacing, const, comments
This commit is contained in:
parent
7f0945d2b1
commit
efc198f952
@ -243,7 +243,7 @@
|
|||||||
/* Custom characters defined in the first 8 characters of the LCD */
|
/* Custom characters defined in the first 8 characters of the LCD */
|
||||||
#define LCD_BEDTEMP_CHAR 0x00 // Print only as a char. This will have 'unexpected' results when used in a string!
|
#define LCD_BEDTEMP_CHAR 0x00 // Print only as a char. This will have 'unexpected' results when used in a string!
|
||||||
#define LCD_DEGREE_CHAR 0x01
|
#define LCD_DEGREE_CHAR 0x01
|
||||||
#define LCD_STR_THERMOMETER "\x02" // Too many places use preprocessor string concatination to change this to a char right now.
|
#define LCD_STR_THERMOMETER "\x02" // Still used with string concatenation
|
||||||
#define LCD_UPLEVEL_CHAR 0x03
|
#define LCD_UPLEVEL_CHAR 0x03
|
||||||
#define LCD_REFRESH_CHAR 0x04
|
#define LCD_REFRESH_CHAR 0x04
|
||||||
#define LCD_STR_FOLDER "\x05"
|
#define LCD_STR_FOLDER "\x05"
|
||||||
|
@ -225,13 +225,11 @@
|
|||||||
*/
|
*/
|
||||||
//#define CASE_LIGHT_ENABLE
|
//#define CASE_LIGHT_ENABLE
|
||||||
#if ENABLED(CASE_LIGHT_ENABLE)
|
#if ENABLED(CASE_LIGHT_ENABLE)
|
||||||
#define CASE_LIGHT_PIN 4 // can be defined here or in the pins_XXX.h file for your board
|
//#define CASE_LIGHT_PIN 4 // Override the default pin if needed
|
||||||
// pins_XXX.h file overrides this one
|
#define INVERT_CASE_LIGHT false // Set true if Case Light is ON when pin is LOW
|
||||||
#define INVERT_CASE_LIGHT false // set to true if case light is ON when pin is at 0
|
#define CASE_LIGHT_DEFAULT_ON true // Set default power-up state on
|
||||||
#define CASE_LIGHT_DEFAULT_ON true // set default power up state to on or off
|
#define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // Set default power-up brightness (0-255, requires PWM pin)
|
||||||
#define CASE_LIGHT_DEFAULT_BRIGHTNESS 105 // set power up brightness 0-255 ( only used if on PWM
|
//#define MENU_ITEM_CASE_LIGHT // Add a Case Light option to the LCD main menu
|
||||||
// and if CASE_LIGHT_DEFAULT is set to on
|
|
||||||
//#define MENU_ITEM_CASE_LIGHT // Uncomment to have a Case Light entry in main menu
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -1394,7 +1394,7 @@ bool get_target_extruder_from_command(int code) {
|
|||||||
*
|
*
|
||||||
* Callers must sync the planner position after calling this!
|
* Callers must sync the planner position after calling this!
|
||||||
*/
|
*/
|
||||||
static void set_axis_is_at_home(AxisEnum axis) {
|
static void set_axis_is_at_home(const AxisEnum axis) {
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) {
|
if (DEBUGGING(LEVELING)) {
|
||||||
SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis_codes[axis]);
|
SERIAL_ECHOPAIR(">>> set_axis_is_at_home(", axis_codes[axis]);
|
||||||
@ -1496,7 +1496,7 @@ static void set_axis_is_at_home(AxisEnum axis) {
|
|||||||
/**
|
/**
|
||||||
* Some planner shorthand inline functions
|
* Some planner shorthand inline functions
|
||||||
*/
|
*/
|
||||||
inline float get_homing_bump_feedrate(AxisEnum axis) {
|
inline float get_homing_bump_feedrate(const AxisEnum axis) {
|
||||||
int constexpr homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
|
int constexpr homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
|
||||||
int hbd = homing_bump_divisor[axis];
|
int hbd = homing_bump_divisor[axis];
|
||||||
if (hbd < 1) {
|
if (hbd < 1) {
|
||||||
@ -1507,20 +1507,19 @@ inline float get_homing_bump_feedrate(AxisEnum axis) {
|
|||||||
return homing_feedrate_mm_s[axis] / hbd;
|
return homing_feedrate_mm_s[axis] / hbd;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/**
|
||||||
// line_to_current_position
|
* Move the planner to the current position from wherever it last moved
|
||||||
// Move the planner to the current position from wherever it last moved
|
* (or from wherever it has been told it is located).
|
||||||
// (or from wherever it has been told it is located).
|
*/
|
||||||
//
|
|
||||||
inline void line_to_current_position() {
|
inline void line_to_current_position() {
|
||||||
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate_mm_s, active_extruder);
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate_mm_s, active_extruder);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/**
|
||||||
// line_to_destination
|
* Move the planner to the position stored in the destination array, which is
|
||||||
// Move the planner, not necessarily synced with current_position
|
* used by G0/G1/G2/G3/G5 and many other functions to set a destination.
|
||||||
//
|
*/
|
||||||
inline void line_to_destination(float fr_mm_s) {
|
inline void line_to_destination(const float fr_mm_s) {
|
||||||
planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], fr_mm_s, active_extruder);
|
planner.buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], fr_mm_s, active_extruder);
|
||||||
}
|
}
|
||||||
inline void line_to_destination() { line_to_destination(feedrate_mm_s); }
|
inline void line_to_destination() { line_to_destination(feedrate_mm_s); }
|
||||||
@ -2751,7 +2750,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
/**
|
/**
|
||||||
* Home an individual linear axis
|
* Home an individual linear axis
|
||||||
*/
|
*/
|
||||||
static void do_homing_move(const AxisEnum axis, float distance, float fr_mm_s=0.0) {
|
static void do_homing_move(const AxisEnum axis, const float distance, const float fr_mm_s=0.0) {
|
||||||
|
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) {
|
if (DEBUGGING(LEVELING)) {
|
||||||
@ -4907,7 +4906,7 @@ void home_all_axes() { gcode_G28(true); }
|
|||||||
if ( NEAR(current_position[X_AXIS], xProbe - (X_PROBE_OFFSET_FROM_EXTRUDER))
|
if ( NEAR(current_position[X_AXIS], xProbe - (X_PROBE_OFFSET_FROM_EXTRUDER))
|
||||||
&& NEAR(current_position[Y_AXIS], yProbe - (Y_PROBE_OFFSET_FROM_EXTRUDER))
|
&& NEAR(current_position[Y_AXIS], yProbe - (Y_PROBE_OFFSET_FROM_EXTRUDER))
|
||||||
) {
|
) {
|
||||||
float simple_z = current_position[Z_AXIS] - measured_z;
|
const float simple_z = current_position[Z_AXIS] - measured_z;
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) {
|
if (DEBUGGING(LEVELING)) {
|
||||||
SERIAL_ECHOPAIR("Z from Probe:", simple_z);
|
SERIAL_ECHOPAIR("Z from Probe:", simple_z);
|
||||||
@ -7667,45 +7666,32 @@ void report_current_position() {
|
|||||||
|
|
||||||
#ifdef M114_DETAIL
|
#ifdef M114_DETAIL
|
||||||
|
|
||||||
static const char axis_char[XYZE] = {'X','Y','Z','E'};
|
void report_xyze(const float pos[XYZE], const uint8_t n = 4, const uint8_t precision = 3) {
|
||||||
|
|
||||||
void report_xyze(const float pos[XYZE], uint8_t n = 4, uint8_t precision = 3) {
|
|
||||||
char str[12];
|
char str[12];
|
||||||
for (uint8_t i = 0; i < n; i++) {
|
for (uint8_t i = 0; i < n; i++) {
|
||||||
SERIAL_CHAR(' ');
|
SERIAL_CHAR(' ');
|
||||||
SERIAL_CHAR(axis_char[i]);
|
SERIAL_CHAR(axis_codes[i]);
|
||||||
SERIAL_CHAR(':');
|
SERIAL_CHAR(':');
|
||||||
SERIAL_PROTOCOL(dtostrf(pos[i], 8, precision, str));
|
SERIAL_PROTOCOL(dtostrf(pos[i], 8, precision, str));
|
||||||
}
|
}
|
||||||
SERIAL_EOL;
|
SERIAL_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void report_xyz(const float pos[XYZ]) {
|
inline void report_xyz(const float pos[XYZ]) { report_xyze(pos, 3); }
|
||||||
report_xyze(pos,3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void report_current_position_detail() {
|
void report_current_position_detail() {
|
||||||
|
|
||||||
stepper.synchronize();
|
stepper.synchronize();
|
||||||
|
|
||||||
SERIAL_EOL;
|
SERIAL_PROTOCOLPGM("\nLogical:");
|
||||||
SERIAL_PROTOCOLPGM("Logical:");
|
|
||||||
report_xyze(current_position);
|
report_xyze(current_position);
|
||||||
|
|
||||||
SERIAL_PROTOCOLPGM("Raw: ");
|
SERIAL_PROTOCOLPGM("Raw: ");
|
||||||
const float raw[XYZ] = {
|
const float raw[XYZ] = { RAW_X_POSITION(current_position[X_AXIS]), RAW_Y_POSITION(current_position[Y_AXIS]), RAW_Z_POSITION(current_position[Z_AXIS]) };
|
||||||
RAW_X_POSITION(current_position[X_AXIS]),
|
|
||||||
RAW_Y_POSITION(current_position[Y_AXIS]),
|
|
||||||
RAW_Z_POSITION(current_position[Z_AXIS])
|
|
||||||
};
|
|
||||||
report_xyz(raw);
|
report_xyz(raw);
|
||||||
|
|
||||||
SERIAL_PROTOCOLPGM("Leveled:");
|
SERIAL_PROTOCOLPGM("Leveled:");
|
||||||
float leveled[XYZ] = {
|
float leveled[XYZ] = { current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] };
|
||||||
current_position[X_AXIS],
|
|
||||||
current_position[Y_AXIS],
|
|
||||||
current_position[Z_AXIS]
|
|
||||||
};
|
|
||||||
planner.apply_leveling(leveled);
|
planner.apply_leveling(leveled);
|
||||||
report_xyz(leveled);
|
report_xyz(leveled);
|
||||||
|
|
||||||
@ -7725,12 +7711,7 @@ void report_current_position() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SERIAL_PROTOCOLPGM("Stepper:");
|
SERIAL_PROTOCOLPGM("Stepper:");
|
||||||
const float step_count[XYZE] = {
|
const float step_count[XYZE] = { stepper.position(X_AXIS), stepper.position(Y_AXIS), stepper.position(Z_AXIS), stepper.position(E_AXIS) };
|
||||||
(float)stepper.position(X_AXIS),
|
|
||||||
(float)stepper.position(Y_AXIS),
|
|
||||||
(float)stepper.position(Z_AXIS),
|
|
||||||
(float)stepper.position(E_AXIS)
|
|
||||||
};
|
|
||||||
report_xyze(step_count, 4, 0);
|
report_xyze(step_count, 4, 0);
|
||||||
|
|
||||||
#if IS_SCARA
|
#if IS_SCARA
|
||||||
@ -7744,12 +7725,7 @@ void report_current_position() {
|
|||||||
|
|
||||||
SERIAL_PROTOCOLPGM("FromStp:");
|
SERIAL_PROTOCOLPGM("FromStp:");
|
||||||
get_cartesian_from_steppers(); // writes cartes[XYZ] (with forward kinematics)
|
get_cartesian_from_steppers(); // writes cartes[XYZ] (with forward kinematics)
|
||||||
const float from_steppers[XYZE] = {
|
const float from_steppers[XYZE] = { cartes[X_AXIS], cartes[Y_AXIS], cartes[Z_AXIS], stepper.get_axis_position_mm(E_AXIS) };
|
||||||
cartes[X_AXIS],
|
|
||||||
cartes[Y_AXIS],
|
|
||||||
cartes[Z_AXIS],
|
|
||||||
stepper.get_axis_position_mm(E_AXIS)
|
|
||||||
};
|
|
||||||
report_xyze(from_steppers);
|
report_xyze(from_steppers);
|
||||||
|
|
||||||
const float diff[XYZE] = {
|
const float diff[XYZE] = {
|
||||||
@ -7764,7 +7740,7 @@ void report_current_position() {
|
|||||||
#endif // M114_DETAIL
|
#endif // M114_DETAIL
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M114: Output current position to serial port
|
* M114: Report current position to host
|
||||||
*/
|
*/
|
||||||
inline void gcode_M114() {
|
inline void gcode_M114() {
|
||||||
|
|
||||||
@ -7859,9 +7835,7 @@ inline void gcode_M115() {
|
|||||||
/**
|
/**
|
||||||
* M117: Set LCD Status Message
|
* M117: Set LCD Status Message
|
||||||
*/
|
*/
|
||||||
inline void gcode_M117() {
|
inline void gcode_M117() { lcd_setstatus(parser.string_arg); }
|
||||||
lcd_setstatus(parser.string_arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M119: Output endstop states to serial output
|
* M119: Output endstop states to serial output
|
||||||
|
@ -104,7 +104,7 @@ class Buzzer {
|
|||||||
* @param duration Duration of the tone in milliseconds
|
* @param duration Duration of the tone in milliseconds
|
||||||
* @param frequency Frequency of the tone in hertz
|
* @param frequency Frequency of the tone in hertz
|
||||||
*/
|
*/
|
||||||
void tone(uint16_t const &duration, uint16_t const &frequency = 0) {
|
void tone(const uint16_t &duration, const uint16_t &frequency = 0) {
|
||||||
while (buffer.isFull()) {
|
while (buffer.isFull()) {
|
||||||
this->tick();
|
this->tick();
|
||||||
thermalManager.manage_heater();
|
thermalManager.manage_heater();
|
||||||
|
@ -457,10 +457,10 @@ void MarlinSettings::postprocess() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DISABLED(ULTIPANEL)
|
#if DISABLED(ULTIPANEL)
|
||||||
const int lcd_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND },
|
constexpr int lcd_preheat_hotend_temp[2] = { PREHEAT_1_TEMP_HOTEND, PREHEAT_2_TEMP_HOTEND },
|
||||||
lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED },
|
lcd_preheat_bed_temp[2] = { PREHEAT_1_TEMP_BED, PREHEAT_2_TEMP_BED },
|
||||||
lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED };
|
lcd_preheat_fan_speed[2] = { PREHEAT_1_FAN_SPEED, PREHEAT_2_FAN_SPEED };
|
||||||
#endif // !ULTIPANEL
|
#endif
|
||||||
|
|
||||||
EEPROM_WRITE(lcd_preheat_hotend_temp);
|
EEPROM_WRITE(lcd_preheat_hotend_temp);
|
||||||
EEPROM_WRITE(lcd_preheat_bed_temp);
|
EEPROM_WRITE(lcd_preheat_bed_temp);
|
||||||
|
@ -193,17 +193,18 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
|
|||||||
static void lcd_implementation_update_indicators();
|
static void lcd_implementation_update_indicators();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void createChar_P(const char c, const byte * const ptr) {
|
||||||
static void createChar_P(char c, PROGMEM byte *ptr) {
|
|
||||||
byte temp[8];
|
byte temp[8];
|
||||||
int8_t i;
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
|
|
||||||
for(i=0; i<8; i++) {
|
|
||||||
temp[i] = pgm_read_byte(&ptr[i]);
|
temp[i] = pgm_read_byte(&ptr[i]);
|
||||||
}
|
|
||||||
lcd.createChar(c, temp);
|
lcd.createChar(c, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void lcd_set_custom_characters(
|
||||||
|
#if ENABLED(LCD_PROGRESS_BAR)
|
||||||
|
const bool info_screen_charset = true
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
const static PROGMEM byte bedTemp[8] = {
|
const static PROGMEM byte bedTemp[8] = {
|
||||||
B00000,
|
B00000,
|
||||||
B11111,
|
B11111,
|
||||||
@ -324,12 +325,6 @@ const static PROGMEM byte clock[8] = {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void lcd_set_custom_characters(
|
|
||||||
#if ENABLED(LCD_PROGRESS_BAR)
|
|
||||||
const bool info_screen_charset = true
|
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
|
|
||||||
createChar_P(LCD_BEDTEMP_CHAR, bedTemp);
|
createChar_P(LCD_BEDTEMP_CHAR, bedTemp);
|
||||||
createChar_P(LCD_DEGREE_CHAR, degree);
|
createChar_P(LCD_DEGREE_CHAR, degree);
|
||||||
createChar_P(LCD_STR_THERMOMETER[0], thermometer);
|
createChar_P(LCD_STR_THERMOMETER[0], thermometer);
|
||||||
@ -638,10 +633,12 @@ FORCE_INLINE void _draw_heater_status(const int8_t heater, const char prefix, co
|
|||||||
#if ENABLED(LCD_PROGRESS_BAR)
|
#if ENABLED(LCD_PROGRESS_BAR)
|
||||||
|
|
||||||
inline void lcd_draw_progress_bar(const uint8_t percent) {
|
inline void lcd_draw_progress_bar(const uint8_t percent) {
|
||||||
int tix = (int)(percent * (LCD_WIDTH) * 3) / 100,
|
const int tix = (int)(percent * (LCD_WIDTH) * 3) / 100,
|
||||||
cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
|
cel = tix / 3,
|
||||||
|
rem = tix % 3;
|
||||||
|
uint8_t i = LCD_WIDTH;
|
||||||
char msg[LCD_WIDTH + 1], b = ' ';
|
char msg[LCD_WIDTH + 1], b = ' ';
|
||||||
msg[i] = '\0';
|
msg[LCD_WIDTH] = '\0';
|
||||||
while (i--) {
|
while (i--) {
|
||||||
if (i == cel - 1)
|
if (i == cel - 1)
|
||||||
b = LCD_STR_PROGRESS[2];
|
b = LCD_STR_PROGRESS[2];
|
||||||
|
Loading…
Reference in New Issue
Block a user