Styling adjustments (PR#2668 & PR#2670)
Keep "astyled" reformatting
This commit is contained in:
committed by
Richard Wackerbarth
parent
b5fb7075b9
commit
0c7f7ebcfb
@ -28,7 +28,7 @@ int absPreheatFanSpeed;
|
||||
typedef void (*menuFunc_t)();
|
||||
|
||||
uint8_t lcd_status_message_level;
|
||||
char lcd_status_message[3*LCD_WIDTH+1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
|
||||
char lcd_status_message[3 * LCD_WIDTH + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
|
||||
|
||||
#if ENABLED(DOGLCD)
|
||||
#include "dogm_lcd_implementation.h"
|
||||
@ -218,7 +218,7 @@ static void lcd_status_screen();
|
||||
#if ENABLED(REPRAPWORLD_KEYPAD)
|
||||
volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
|
||||
#endif
|
||||
|
||||
|
||||
#if ENABLED(LCD_HAS_SLOW_BUTTONS)
|
||||
volatile uint8_t slow_buttons; // Bits of the pressed buttons.
|
||||
#endif
|
||||
@ -254,7 +254,7 @@ float raw_Ki, raw_Kd;
|
||||
/**
|
||||
* General function to go directly to a menu
|
||||
*/
|
||||
static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint32_t encoder=0) {
|
||||
static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const uint32_t encoder = 0) {
|
||||
if (currentMenu != menu) {
|
||||
currentMenu = menu;
|
||||
#if ENABLED(NEWPANEL)
|
||||
@ -276,7 +276,7 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint
|
||||
*/
|
||||
|
||||
static void lcd_status_screen() {
|
||||
encoderRateMultiplierEnabled = false;
|
||||
encoderRateMultiplierEnabled = false;
|
||||
|
||||
#if ENABLED(LCD_PROGRESS_BAR)
|
||||
millis_t ms = millis();
|
||||
@ -346,7 +346,7 @@ static void lcd_status_screen() {
|
||||
#if ENABLED(ULTIPANEL_FEEDMULTIPLY)
|
||||
// Dead zone at 100% feedrate
|
||||
if ((feedrate_multiplier < 100 && (feedrate_multiplier + int(encoderPosition)) > 100) ||
|
||||
(feedrate_multiplier > 100 && (feedrate_multiplier + int(encoderPosition)) < 100)) {
|
||||
(feedrate_multiplier > 100 && (feedrate_multiplier + int(encoderPosition)) < 100)) {
|
||||
encoderPosition = 0;
|
||||
feedrate_multiplier = 100;
|
||||
}
|
||||
@ -459,7 +459,7 @@ void lcd_set_home_offsets() {
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
|
||||
static void _lcd_babystep(int axis, const char *msg) {
|
||||
static void _lcd_babystep(int axis, const char* msg) {
|
||||
if (encoderPosition != 0) {
|
||||
babystepsTodo[axis] += (int)encoderPosition;
|
||||
encoderPosition = 0;
|
||||
@ -800,7 +800,7 @@ inline void line_to_current(AxisEnum axis) {
|
||||
float move_menu_scale;
|
||||
static void lcd_move_menu_axis();
|
||||
|
||||
static void _lcd_move(const char *name, AxisEnum axis, int min, int max) {
|
||||
static void _lcd_move(const char* name, AxisEnum axis, int min, int max) {
|
||||
if (encoderPosition != 0) {
|
||||
refresh_cmd_timeout();
|
||||
current_position[axis] += float((int)encoderPosition) * move_menu_scale;
|
||||
@ -1179,8 +1179,8 @@ static void lcd_control_motion_menu() {
|
||||
MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit);
|
||||
#endif
|
||||
#if ENABLED(SCARA)
|
||||
MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2);
|
||||
MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2);
|
||||
MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS], 0.5, 2);
|
||||
MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS], 0.5, 2);
|
||||
#endif
|
||||
END_MENU();
|
||||
}
|
||||
@ -1289,7 +1289,7 @@ static void lcd_control_volumetric_menu() {
|
||||
*
|
||||
*/
|
||||
void lcd_sdcard_menu() {
|
||||
if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) return; // nothing to do (so don't thrash the SD card)
|
||||
if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) return; // nothing to do (so don't thrash the SD card)
|
||||
uint16_t fileCnt = card.getnrfilenames();
|
||||
START_MENU();
|
||||
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
|
||||
@ -1323,7 +1323,7 @@ static void lcd_control_volumetric_menu() {
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
#endif //SDSUPPORT
|
||||
#endif //SDSUPPORT
|
||||
|
||||
/**
|
||||
*
|
||||
@ -1336,7 +1336,7 @@ static void lcd_control_volumetric_menu() {
|
||||
if ((int32_t)encoderPosition < 0) encoderPosition = 0; \
|
||||
if ((int32_t)encoderPosition > maxEditValue) encoderPosition = maxEditValue; \
|
||||
if (lcdDrawUpdate) \
|
||||
lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
|
||||
lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
|
||||
if (isClicked) { \
|
||||
*((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
|
||||
lcd_goto_menu(prevMenu, prevEncoderPosition); \
|
||||
@ -1348,10 +1348,10 @@ static void lcd_control_volumetric_menu() {
|
||||
static void _menu_action_setting_edit_ ## _name (const char* pstr, _type* ptr, _type minValue, _type maxValue) { \
|
||||
prevMenu = currentMenu; \
|
||||
prevEncoderPosition = encoderPosition; \
|
||||
\
|
||||
\
|
||||
lcdDrawUpdate = 2; \
|
||||
currentMenu = menu_edit_ ## _name; \
|
||||
\
|
||||
\
|
||||
editLabel = pstr; \
|
||||
editValue = ptr; \
|
||||
minEditValue = minValue * scale; \
|
||||
@ -1433,14 +1433,14 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01)
|
||||
void lcd_quick_feedback() {
|
||||
lcdDrawUpdate = 2;
|
||||
next_button_update_ms = millis() + 500;
|
||||
|
||||
|
||||
#if ENABLED(LCD_USE_I2C_BUZZER)
|
||||
#ifndef LCD_FEEDBACK_FREQUENCY_HZ
|
||||
#define LCD_FEEDBACK_FREQUENCY_HZ 100
|
||||
#endif
|
||||
#ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
|
||||
#define LCD_FEEDBACK_FREQUENCY_DURATION_MS (1000/6)
|
||||
#endif
|
||||
#endif
|
||||
lcd.buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
|
||||
#elif PIN_EXISTS(BEEPER)
|
||||
#ifndef LCD_FEEDBACK_FREQUENCY_HZ
|
||||
@ -1474,7 +1474,7 @@ static void menu_action_function(menuFunc_t func) { (*func)(); }
|
||||
char cmd[30];
|
||||
char* c;
|
||||
sprintf_P(cmd, PSTR("M23 %s"), filename);
|
||||
for(c = &cmd[4]; *c; c++) *c = tolower(*c);
|
||||
for (c = &cmd[4]; *c; c++) *c = tolower(*c);
|
||||
enqueuecommand(cmd);
|
||||
enqueuecommands_P(PSTR("M24"));
|
||||
lcd_return_to_status();
|
||||
@ -1497,39 +1497,45 @@ static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr,
|
||||
|
||||
/** LCD API **/
|
||||
void lcd_init() {
|
||||
|
||||
lcd_implementation_init();
|
||||
|
||||
#if ENABLED(NEWPANEL)
|
||||
|
||||
SET_INPUT(BTN_EN1);
|
||||
SET_INPUT(BTN_EN2);
|
||||
WRITE(BTN_EN1,HIGH);
|
||||
WRITE(BTN_EN2,HIGH);
|
||||
#if BTN_ENC > 0
|
||||
SET_INPUT(BTN_ENC);
|
||||
WRITE(BTN_ENC,HIGH);
|
||||
#endif
|
||||
#if ENABLED(REPRAPWORLD_KEYPAD)
|
||||
pinMode(SHIFT_CLK,OUTPUT);
|
||||
pinMode(SHIFT_LD,OUTPUT);
|
||||
pinMode(SHIFT_OUT,INPUT);
|
||||
WRITE(SHIFT_OUT,HIGH);
|
||||
WRITE(SHIFT_LD,HIGH);
|
||||
#endif
|
||||
#else // Not NEWPANEL
|
||||
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
|
||||
pinMode (SR_DATA_PIN, OUTPUT);
|
||||
pinMode (SR_CLK_PIN, OUTPUT);
|
||||
#elif defined(SHIFT_CLK)
|
||||
pinMode(SHIFT_CLK,OUTPUT);
|
||||
pinMode(SHIFT_LD,OUTPUT);
|
||||
pinMode(SHIFT_EN,OUTPUT);
|
||||
pinMode(SHIFT_OUT,INPUT);
|
||||
WRITE(SHIFT_OUT,HIGH);
|
||||
WRITE(SHIFT_LD,HIGH);
|
||||
WRITE(SHIFT_EN,LOW);
|
||||
#endif // SR_LCD_2W_NL
|
||||
#endif//!NEWPANEL
|
||||
WRITE(BTN_EN1, HIGH);
|
||||
WRITE(BTN_EN2, HIGH);
|
||||
|
||||
#if BTN_ENC > 0
|
||||
SET_INPUT(BTN_ENC);
|
||||
WRITE(BTN_ENC, HIGH);
|
||||
#endif
|
||||
|
||||
#if ENABLED(REPRAPWORLD_KEYPAD)
|
||||
pinMode(SHIFT_CLK, OUTPUT);
|
||||
pinMode(SHIFT_LD, OUTPUT);
|
||||
pinMode(SHIFT_OUT, INPUT);
|
||||
WRITE(SHIFT_OUT, HIGH);
|
||||
WRITE(SHIFT_LD, HIGH);
|
||||
#endif
|
||||
|
||||
#else // Not NEWPANEL
|
||||
|
||||
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
|
||||
pinMode(SR_DATA_PIN, OUTPUT);
|
||||
pinMode(SR_CLK_PIN, OUTPUT);
|
||||
#elif defined(SHIFT_CLK)
|
||||
pinMode(SHIFT_CLK, OUTPUT);
|
||||
pinMode(SHIFT_LD, OUTPUT);
|
||||
pinMode(SHIFT_EN, OUTPUT);
|
||||
pinMode(SHIFT_OUT, INPUT);
|
||||
WRITE(SHIFT_OUT, HIGH);
|
||||
WRITE(SHIFT_LD, HIGH);
|
||||
WRITE(SHIFT_EN, LOW);
|
||||
#endif // SR_LCD_2W_NL
|
||||
|
||||
#endif//!NEWPANEL
|
||||
|
||||
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
|
||||
pinMode(SD_DETECT_PIN, INPUT);
|
||||
@ -1548,7 +1554,7 @@ void lcd_init() {
|
||||
#endif
|
||||
}
|
||||
|
||||
int lcd_strlen(char *s) {
|
||||
int lcd_strlen(char* s) {
|
||||
int i = 0, j = 0;
|
||||
while (s[i]) {
|
||||
if ((s[i] & 0xc0) != 0x80) j++;
|
||||
@ -1557,7 +1563,7 @@ int lcd_strlen(char *s) {
|
||||
return j;
|
||||
}
|
||||
|
||||
int lcd_strlen_P(const char *s) {
|
||||
int lcd_strlen_P(const char* s) {
|
||||
int j = 0;
|
||||
while (pgm_read_byte(s)) {
|
||||
if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
|
||||
@ -1614,7 +1620,7 @@ void lcd_update() {
|
||||
}
|
||||
|
||||
#endif //SDSUPPORT && SD_DETECT_PIN
|
||||
|
||||
|
||||
millis_t ms = millis();
|
||||
if (ms > next_lcd_update_ms) {
|
||||
|
||||
@ -1683,18 +1689,18 @@ void lcd_update() {
|
||||
}
|
||||
}
|
||||
#if ENABLED(DOGLCD) // Changes due to different driver architecture of the DOGM display
|
||||
if (lcdDrawUpdate) {
|
||||
blink++; // Variable for fan animation and alive dot
|
||||
u8g.firstPage();
|
||||
do {
|
||||
lcd_setFont(FONT_MENU);
|
||||
u8g.setPrintPos(125, 0);
|
||||
if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
|
||||
u8g.drawPixel(127, 63); // draw alive dot
|
||||
u8g.setColorIndex(1); // black on white
|
||||
(*currentMenu)();
|
||||
} while( u8g.nextPage() );
|
||||
}
|
||||
if (lcdDrawUpdate) {
|
||||
blink++; // Variable for fan animation and alive dot
|
||||
u8g.firstPage();
|
||||
do {
|
||||
lcd_setFont(FONT_MENU);
|
||||
u8g.setPrintPos(125, 0);
|
||||
if (blink % 2) u8g.setColorIndex(1); else u8g.setColorIndex(0); // Set color for the alive dot
|
||||
u8g.drawPixel(127, 63); // draw alive dot
|
||||
u8g.setColorIndex(1); // black on white
|
||||
(*currentMenu)();
|
||||
} while (u8g.nextPage());
|
||||
}
|
||||
#else
|
||||
if (lcdDrawUpdate)
|
||||
(*currentMenu)();
|
||||
@ -1749,7 +1755,7 @@ void lcd_finishstatus(bool persist=false) {
|
||||
void dontExpireStatus() { expire_status_ms = 0; }
|
||||
#endif
|
||||
|
||||
void set_utf_strlen(char *s, uint8_t n) {
|
||||
void set_utf_strlen(char* s, uint8_t n) {
|
||||
uint8_t i = 0, j = 0;
|
||||
while (s[i] && (j < n)) {
|
||||
if ((s[i] & 0xc0u) != 0x80u) j++;
|
||||
@ -1763,14 +1769,14 @@ bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
|
||||
|
||||
void lcd_setstatus(const char* message, bool persist) {
|
||||
if (lcd_status_message_level > 0) return;
|
||||
strncpy(lcd_status_message, message, 3*LCD_WIDTH);
|
||||
strncpy(lcd_status_message, message, 3 * LCD_WIDTH);
|
||||
set_utf_strlen(lcd_status_message, LCD_WIDTH);
|
||||
lcd_finishstatus(persist);
|
||||
}
|
||||
|
||||
void lcd_setstatuspgm(const char* message, uint8_t level) {
|
||||
if (level >= lcd_status_message_level) {
|
||||
strncpy_P(lcd_status_message, message, 3*LCD_WIDTH);
|
||||
strncpy_P(lcd_status_message, message, 3 * LCD_WIDTH);
|
||||
set_utf_strlen(lcd_status_message, LCD_WIDTH);
|
||||
lcd_status_message_level = level;
|
||||
lcd_finishstatus(level > 0);
|
||||
@ -1825,23 +1831,23 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||
#endif
|
||||
#if ENABLED(REPRAPWORLD_KEYPAD)
|
||||
// for the reprapworld_keypad
|
||||
uint8_t newbutton_reprapworld_keypad=0;
|
||||
uint8_t newbutton_reprapworld_keypad = 0;
|
||||
WRITE(SHIFT_LD, LOW);
|
||||
WRITE(SHIFT_LD, HIGH);
|
||||
for(int8_t i = 0; i < 8; i++) {
|
||||
for (int8_t i = 0; i < 8; i++) {
|
||||
newbutton_reprapworld_keypad >>= 1;
|
||||
if (READ(SHIFT_OUT)) newbutton_reprapworld_keypad |= BIT(7);
|
||||
WRITE(SHIFT_CLK, HIGH);
|
||||
WRITE(SHIFT_CLK, LOW);
|
||||
}
|
||||
buttons_reprapworld_keypad=~newbutton_reprapworld_keypad; //invert it, because a pressed switch produces a logical 0
|
||||
buttons_reprapworld_keypad = ~newbutton_reprapworld_keypad; //invert it, because a pressed switch produces a logical 0
|
||||
#endif
|
||||
#else //read it from the shift register
|
||||
uint8_t newbutton = 0;
|
||||
WRITE(SHIFT_LD, LOW);
|
||||
WRITE(SHIFT_LD, HIGH);
|
||||
unsigned char tmp_buttons = 0;
|
||||
for(int8_t i=0; i<8; i++) {
|
||||
for (int8_t i = 0; i < 8; i++) {
|
||||
newbutton >>= 1;
|
||||
if (READ(SHIFT_OUT)) newbutton |= BIT(7);
|
||||
WRITE(SHIFT_CLK, HIGH);
|
||||
@ -1851,26 +1857,26 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||
#endif //!NEWPANEL
|
||||
|
||||
//manage encoder rotation
|
||||
uint8_t enc=0;
|
||||
uint8_t enc = 0;
|
||||
if (buttons & EN_A) enc |= B01;
|
||||
if (buttons & EN_B) enc |= B10;
|
||||
if (enc != lastEncoderBits) {
|
||||
switch(enc) {
|
||||
switch (enc) {
|
||||
case encrot0:
|
||||
if (lastEncoderBits==encrot3) encoderDiff++;
|
||||
else if (lastEncoderBits==encrot1) encoderDiff--;
|
||||
if (lastEncoderBits == encrot3) encoderDiff++;
|
||||
else if (lastEncoderBits == encrot1) encoderDiff--;
|
||||
break;
|
||||
case encrot1:
|
||||
if (lastEncoderBits==encrot0) encoderDiff++;
|
||||
else if (lastEncoderBits==encrot2) encoderDiff--;
|
||||
if (lastEncoderBits == encrot0) encoderDiff++;
|
||||
else if (lastEncoderBits == encrot2) encoderDiff--;
|
||||
break;
|
||||
case encrot2:
|
||||
if (lastEncoderBits==encrot1) encoderDiff++;
|
||||
else if (lastEncoderBits==encrot3) encoderDiff--;
|
||||
if (lastEncoderBits == encrot1) encoderDiff++;
|
||||
else if (lastEncoderBits == encrot3) encoderDiff--;
|
||||
break;
|
||||
case encrot3:
|
||||
if (lastEncoderBits==encrot2) encoderDiff++;
|
||||
else if (lastEncoderBits==encrot0) encoderDiff--;
|
||||
if (lastEncoderBits == encrot2) encoderDiff++;
|
||||
else if (lastEncoderBits == encrot0) encoderDiff--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1896,12 +1902,12 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
|
||||
char conv[8];
|
||||
|
||||
// Convert float to string with +123.4 format
|
||||
char *ftostr3(const float &x) {
|
||||
char* ftostr3(const float& x) {
|
||||
return itostr3((int)x);
|
||||
}
|
||||
|
||||
// Convert int to string with 12 format
|
||||
char *itostr2(const uint8_t &x) {
|
||||
char* itostr2(const uint8_t& x) {
|
||||
//sprintf(conv,"%5.1f",x);
|
||||
int xx = x;
|
||||
conv[0] = (xx / 10) % 10 + '0';
|
||||
@ -1911,7 +1917,7 @@ char *itostr2(const uint8_t &x) {
|
||||
}
|
||||
|
||||
// Convert float to string with +123.4 format
|
||||
char *ftostr31(const float &x) {
|
||||
char* ftostr31(const float& x) {
|
||||
int xx = abs(x * 10);
|
||||
conv[0] = (x >= 0) ? '+' : '-';
|
||||
conv[1] = (xx / 1000) % 10 + '0';
|
||||
@ -1924,7 +1930,7 @@ char *ftostr31(const float &x) {
|
||||
}
|
||||
|
||||
// Convert float to string with 123.4 format, dropping sign
|
||||
char *ftostr31ns(const float &x) {
|
||||
char* ftostr31ns(const float& x) {
|
||||
int xx = abs(x * 10);
|
||||
conv[0] = (xx / 1000) % 10 + '0';
|
||||
conv[1] = (xx / 100) % 10 + '0';
|
||||
@ -1936,7 +1942,7 @@ char *ftostr31ns(const float &x) {
|
||||
}
|
||||
|
||||
// Convert float to string with 123.4 format
|
||||
char *ftostr32(const float &x) {
|
||||
char* ftostr32(const float& x) {
|
||||
long xx = abs(x * 100);
|
||||
conv[0] = x >= 0 ? (xx / 10000) % 10 + '0' : '-';
|
||||
conv[1] = (xx / 1000) % 10 + '0';
|
||||
@ -1949,39 +1955,37 @@ char *ftostr32(const float &x) {
|
||||
}
|
||||
|
||||
// Convert float to string with 1.234 format
|
||||
char *ftostr43(const float &x) {
|
||||
long xx = x * 1000;
|
||||
if (xx >= 0)
|
||||
conv[0] = (xx / 1000) % 10 + '0';
|
||||
else
|
||||
conv[0] = '-';
|
||||
xx = abs(xx);
|
||||
conv[1] = '.';
|
||||
conv[2] = (xx / 100) % 10 + '0';
|
||||
conv[3] = (xx / 10) % 10 + '0';
|
||||
conv[4] = (xx) % 10 + '0';
|
||||
conv[5] = 0;
|
||||
return conv;
|
||||
char* ftostr43(const float& x) {
|
||||
long xx = x * 1000;
|
||||
if (xx >= 0)
|
||||
conv[0] = (xx / 1000) % 10 + '0';
|
||||
else
|
||||
conv[0] = '-';
|
||||
xx = abs(xx);
|
||||
conv[1] = '.';
|
||||
conv[2] = (xx / 100) % 10 + '0';
|
||||
conv[3] = (xx / 10) % 10 + '0';
|
||||
conv[4] = (xx) % 10 + '0';
|
||||
conv[5] = 0;
|
||||
return conv;
|
||||
}
|
||||
|
||||
// Convert float to string with 1.23 format
|
||||
char *ftostr12ns(const float &x) {
|
||||
long xx=x*100;
|
||||
|
||||
xx=abs(xx);
|
||||
conv[0]=(xx/100)%10+'0';
|
||||
conv[1]='.';
|
||||
conv[2]=(xx/10)%10+'0';
|
||||
conv[3]=(xx)%10+'0';
|
||||
conv[4]=0;
|
||||
char* ftostr12ns(const float& x) {
|
||||
long xx = x * 100;
|
||||
xx = abs(xx);
|
||||
conv[0] = (xx / 100) % 10 + '0';
|
||||
conv[1] = '.';
|
||||
conv[2] = (xx / 10) % 10 + '0';
|
||||
conv[3] = (xx) % 10 + '0';
|
||||
conv[4] = 0;
|
||||
return conv;
|
||||
}
|
||||
|
||||
// Convert float to space-padded string with -_23.4_ format
|
||||
char *ftostr32sp(const float &x) {
|
||||
char* ftostr32sp(const float& x) {
|
||||
long xx = abs(x * 100);
|
||||
uint8_t dig;
|
||||
|
||||
if (x < 0) { // negative val = -_0
|
||||
conv[0] = '-';
|
||||
dig = (xx / 1000) % 10;
|
||||
@ -2024,7 +2028,7 @@ char *ftostr32sp(const float &x) {
|
||||
}
|
||||
|
||||
// Convert int to lj string with +123.0 format
|
||||
char *itostr31(const int &x) {
|
||||
char* itostr31(const int& x) {
|
||||
conv[0] = x >= 0 ? '+' : '-';
|
||||
int xx = abs(x);
|
||||
conv[1] = (xx / 100) % 10 + '0';
|
||||
@ -2037,11 +2041,11 @@ char *itostr31(const int &x) {
|
||||
}
|
||||
|
||||
// Convert int to rj string with 123 or -12 format
|
||||
char *itostr3(const int &x) {
|
||||
char* itostr3(const int& x) {
|
||||
int xx = x;
|
||||
if (xx < 0) {
|
||||
conv[0] = '-';
|
||||
xx = -xx;
|
||||
conv[0] = '-';
|
||||
xx = -xx;
|
||||
}
|
||||
else
|
||||
conv[0] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
|
||||
@ -2053,7 +2057,7 @@ char *itostr3(const int &x) {
|
||||
}
|
||||
|
||||
// Convert int to lj string with 123 format
|
||||
char *itostr3left(const int &xx) {
|
||||
char* itostr3left(const int& xx) {
|
||||
if (xx >= 100) {
|
||||
conv[0] = (xx / 100) % 10 + '0';
|
||||
conv[1] = (xx / 10) % 10 + '0';
|
||||
@ -2073,7 +2077,7 @@ char *itostr3left(const int &xx) {
|
||||
}
|
||||
|
||||
// Convert int to rj string with 1234 format
|
||||
char *itostr4(const int &xx) {
|
||||
char* itostr4(const int& xx) {
|
||||
conv[0] = xx >= 1000 ? (xx / 1000) % 10 + '0' : ' ';
|
||||
conv[1] = xx >= 100 ? (xx / 100) % 10 + '0' : ' ';
|
||||
conv[2] = xx >= 10 ? (xx / 10) % 10 + '0' : ' ';
|
||||
@ -2083,7 +2087,7 @@ char *itostr4(const int &xx) {
|
||||
}
|
||||
|
||||
// Convert float to rj string with 12345 format
|
||||
char *ftostr5(const float &x) {
|
||||
char* ftostr5(const float& x) {
|
||||
long xx = abs(x);
|
||||
conv[0] = xx >= 10000 ? (xx / 10000) % 10 + '0' : ' ';
|
||||
conv[1] = xx >= 1000 ? (xx / 1000) % 10 + '0' : ' ';
|
||||
@ -2095,7 +2099,7 @@ char *ftostr5(const float &x) {
|
||||
}
|
||||
|
||||
// Convert float to string with +1234.5 format
|
||||
char *ftostr51(const float &x) {
|
||||
char* ftostr51(const float& x) {
|
||||
long xx = abs(x * 10);
|
||||
conv[0] = (x >= 0) ? '+' : '-';
|
||||
conv[1] = (xx / 10000) % 10 + '0';
|
||||
@ -2109,7 +2113,7 @@ char *ftostr51(const float &x) {
|
||||
}
|
||||
|
||||
// Convert float to string with +123.45 format
|
||||
char *ftostr52(const float &x) {
|
||||
char* ftostr52(const float& x) {
|
||||
conv[0] = (x >= 0) ? '+' : '-';
|
||||
long xx = abs(x * 100);
|
||||
conv[1] = (xx / 10000) % 10 + '0';
|
||||
@ -2151,7 +2155,7 @@ char *ftostr52(const float &x) {
|
||||
if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
|
||||
mbl.set_z(ix, iy, current_position[Z_AXIS]);
|
||||
_lcd_level_bed_position++;
|
||||
if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
|
||||
if (_lcd_level_bed_position == MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) {
|
||||
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
||||
line_to_current(Z_AXIS);
|
||||
mbl.active = 1;
|
||||
|
Reference in New Issue
Block a user