Commit ffae6ccd authored by Franco (nextime) Lanza's avatar Franco (nextime) Lanza

Merge remote-tracking branch 'upstream/dev' into dev

parents 2a614266 3f127b2a
...@@ -55,10 +55,13 @@ ...@@ -55,10 +55,13 @@
// Uncomment to include more info in ok command // Uncomment to include more info in ok command
//#define ADVANCED_OK //#define ADVANCED_OK
// By default MarlinKimbra will send a busy status message to the host //
// Host Keepalive
//
// When enabled MarlinKimbra will send a busy status message to the host
// every couple of seconds when it can't accept commands. // every couple of seconds when it can't accept commands.
// Enable this option if your host doesn't like keepalive messages. #define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages
//#define DISABLE_HOST_KEEPALIVE #define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
/***********************************************************************/ /***********************************************************************/
......
...@@ -1494,9 +1494,9 @@ ...@@ -1494,9 +1494,9 @@
************************** Motor's current **************************** ************************** Motor's current ****************************
***********************************************************************/ ***********************************************************************/
// Motor Current setting (Only functional on ALLIGATOR BOARD) // Motor Current setting (Only functional on ALLIGATOR BOARD)
#define MOTOR_CURRENT {1, 1, 1, 1, 1, 1, 1} // X Y Z E0 E1 E2 E3 - Values 0 - 2.5 A #define MOTOR_CURRENT {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0} // X Y Z E0 E1 E2 E3 - Values 0 - 2.5 A
// Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards) // Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A) #define DIGIPOT_MOTOR_CURRENT {135, 135, 135, 135, 135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
/***********************************************************************/ /***********************************************************************/
......
...@@ -94,6 +94,8 @@ ...@@ -94,6 +94,8 @@
#define E0E1_CHOICE_PIN -1 #define E0E1_CHOICE_PIN -1
#define E0E2_CHOICE_PIN -1 #define E0E2_CHOICE_PIN -1
#define E0E3_CHOICE_PIN -1 #define E0E3_CHOICE_PIN -1
#define E0E4_CHOICE_PIN -1
#define E0E5_CHOICE_PIN -1
#define E1E3_CHOICE_PIN -1 #define E1E3_CHOICE_PIN -1
#endif #endif
......
...@@ -463,21 +463,15 @@ void Config_ResetDefault() { ...@@ -463,21 +463,15 @@ void Config_ResetDefault() {
float tmp3[] = DEFAULT_MAX_ACCELERATION; float tmp3[] = DEFAULT_MAX_ACCELERATION;
float tmp4[] = DEFAULT_RETRACT_ACCELERATION; float tmp4[] = DEFAULT_RETRACT_ACCELERATION;
float tmp5[] = DEFAULT_EJERK; float tmp5[] = DEFAULT_EJERK;
#if ENABLED(PIDTEMP) float tmp6[] = DEFAULT_Kp;
float tmp6[] = DEFAULT_Kp; float tmp7[] = DEFAULT_Ki;
float tmp7[] = DEFAULT_Ki; float tmp8[] = DEFAULT_Kd;
float tmp8[] = DEFAULT_Kd; float tmp9[] = DEFAULT_Kc;
float tmp9[] = DEFAULT_Kc;
#endif // PIDTEMP
#if ENABLED(HOTEND_OFFSET_X) && ENABLED(HOTEND_OFFSET_Y) && ENABLED(HOTEND_OFFSET_Z) #if ENABLED(HOTEND_OFFSET_X) && ENABLED(HOTEND_OFFSET_Y) && ENABLED(HOTEND_OFFSET_Z)
float tmp10[] = HOTEND_OFFSET_X; float tmp10[] = HOTEND_OFFSET_X;
float tmp11[] = HOTEND_OFFSET_Y; float tmp11[] = HOTEND_OFFSET_Y;
float tmp12[] = HOTEND_OFFSET_Z; float tmp12[] = HOTEND_OFFSET_Z;
#else
float tmp10[] = {0};
float tmp11[] = {0};
float tmp12[] = {0};
#endif #endif
#if MB(ALLIGATOR) #if MB(ALLIGATOR)
...@@ -485,55 +479,30 @@ void Config_ResetDefault() { ...@@ -485,55 +479,30 @@ void Config_ResetDefault() {
#endif #endif
for (int8_t i = 0; i < 3 + EXTRUDERS; i++) { for (int8_t i = 0; i < 3 + EXTRUDERS; i++) {
short max_i; axis_steps_per_unit[i] = tmp1[i];
max_i = sizeof(tmp1) / sizeof(*tmp1); max_feedrate[i] = tmp2[i];
if(i < max_i) max_acceleration_units_per_sq_second[i] = tmp3[i];
axis_steps_per_unit[i] = tmp1[i]; }
else
axis_steps_per_unit[i] = tmp1[max_i - 1]; for (int8_t i = 0; i < EXTRUDERS; i++) {
max_i = sizeof(tmp2) / sizeof(*tmp2); retract_acceleration[i] = tmp4[i];
if(i < max_i) max_e_jerk[i] = tmp5[i];
max_feedrate[i] = tmp2[i]; }
else
max_feedrate[i] = tmp2[max_i - 1]; #if MB(ALLIGATOR)
max_i = sizeof(tmp3) / sizeof(*tmp3); for (int8_t i = 0; i < 3 + DRIVER_EXTRUDERS; i++)
if(i < max_i) motor_current[i] = tmp13[i];
max_acceleration_units_per_sq_second[i] = tmp3[i]; #endif
else
max_acceleration_units_per_sq_second[i] = tmp3[max_i - 1]; for (int8_t i = 0; i < HOTENDS; i++) {
if(i < EXTRUDERS) { #if ENABLED(HOTEND_OFFSET_X) && ENABLED(HOTEND_OFFSET_Y) && ENABLED(HOTEND_OFFSET_Z)
max_i = sizeof(tmp4) / sizeof(*tmp4); hotend_offset[X_AXIS][i] = tmp10[i];
if(i < max_i) hotend_offset[Y_AXIS][i] = tmp11[i];
retract_acceleration[i] = tmp4[i]; hotend_offset[Z_AXIS][i] = tmp12[i];
else #else
retract_acceleration[i] = tmp4[max_i - 1]; hotend_offset[X_AXIS][i] = 0;
max_i = sizeof(tmp5) / sizeof(*tmp5); hotend_offset[Y_AXIS][i] = 0;
if(i < max_i) hotend_offset[Z_AXIS][i] = 0;
max_e_jerk[i] = tmp5[i];
else
max_e_jerk[i] = tmp5[max_i - 1];
max_i = sizeof(tmp10) / sizeof(*tmp10);
if(i < max_i)
hotend_offset[X_AXIS][i] = tmp10[i];
else
hotend_offset[X_AXIS][i] = 0;
max_i = sizeof(tmp11) / sizeof(*tmp11);
if(i < max_i)
hotend_offset[Y_AXIS][i] = tmp11[i];
else
hotend_offset[Y_AXIS][i] = 0;
max_i = sizeof(tmp12) / sizeof(*tmp12);
if(i < max_i)
hotend_offset[Z_AXIS][i] = tmp12[i];
else
hotend_offset[Z_AXIS][i] = 0;
}
#if MB(ALLIGATOR)
max_i = sizeof(tmp13) / sizeof(*tmp13);
if(i < max_i)
motor_current[i] = tmp13[i];
else
motor_current[i] = tmp13[max_i - 1];
#endif #endif
} }
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
......
This diff is collapsed.
...@@ -139,6 +139,12 @@ extern bool axis_known_position[3]; ...@@ -139,6 +139,12 @@ extern bool axis_known_position[3];
extern bool axis_homed[3]; extern bool axis_homed[3];
extern float zprobe_zoffset; extern float zprobe_zoffset;
// GCode support for external objects
bool code_seen(char);
float code_value();
long code_value_long();
int16_t code_value_short();
#if ENABLED(ADVANCE_LPC) #if ENABLED(ADVANCE_LPC)
extern int extruder_advance_k; extern int extruder_advance_k;
#endif #endif
...@@ -254,7 +260,7 @@ extern uint8_t previous_extruder; ...@@ -254,7 +260,7 @@ extern uint8_t previous_extruder;
extern uint8_t active_driver; extern uint8_t active_driver;
#if MB(ALLIGATOR) #if MB(ALLIGATOR)
extern float motor_current[DRIVER_EXTRUDERS + 3]; extern float motor_current[3 + DRIVER_EXTRUDERS];
#endif #endif
#if ENABLED(DIGIPOT_I2C) #if ENABLED(DIGIPOT_I2C)
...@@ -282,19 +288,12 @@ extern uint8_t active_driver; ...@@ -282,19 +288,12 @@ extern uint8_t active_driver;
extern float mixing_factor[DRIVER_EXTRUDERS]; extern float mixing_factor[DRIVER_EXTRUDERS];
#endif #endif
extern void calculate_volumetric_multipliers(); void calculate_volumetric_multipliers();
#if ENABLED(M100_FREE_MEMORY_WATCHER) #if ENABLED(M100_FREE_MEMORY_WATCHER)
extern void *__brkval; extern void *__brkval;
extern size_t __heap_start, __heap_end, __flp; extern size_t __heap_start, __heap_end, __flp;
//
// Declare all the functions we need from Marlin_Main.cpp to do the work!
//
float code_value();
long code_value_long();
bool code_seen(char );
// //
// Utility functions used by M100 to get its work done. // Utility functions used by M100 to get its work done.
// //
......
...@@ -475,10 +475,9 @@ ...@@ -475,10 +475,9 @@
#endif #endif
/** /**
* Avoid double-negatives for enabling features * Host keep alive
*/ */
#if DISABLED(DISABLE_HOST_KEEPALIVE) #if DISABLED(DEFAULT_KEEPALIVE_INTERVAL)
#define HOST_KEEPALIVE_FEATURE
#define DEFAULT_KEEPALIVE_INTERVAL 2 #define DEFAULT_KEEPALIVE_INTERVAL 2
#endif #endif
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
#define DOGM_LCD_IMPLEMENTATION_H #define DOGM_LCD_IMPLEMENTATION_H
/** /**
* Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays. * Implementation of the LCD display routines for a DOGM128 graphic display.
* These are common LCD 128x64 pixel graphic displays.
*/ */
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
...@@ -144,6 +145,7 @@ ...@@ -144,6 +145,7 @@
// LCD selection // LCD selection
#if ENABLED(U8GLIB_ST7920) #if ENABLED(U8GLIB_ST7920)
//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
U8GLIB_ST7920_128X64_RRD u8g(0); U8GLIB_ST7920_128X64_RRD u8g(0);
#elif ENABLED(MAKRPANEL) #elif ENABLED(MAKRPANEL)
// The MaKrPanel display, ST7565 controller as well // The MaKrPanel display, ST7565 controller as well
...@@ -175,7 +177,6 @@ ...@@ -175,7 +177,6 @@
#include "utf_mapper.h" #include "utf_mapper.h"
int lcd_contrast; int lcd_contrast;
static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
static char currentfont = 0; static char currentfont = 0;
static void lcd_setFont(char font_nr) { static void lcd_setFont(char font_nr) {
...@@ -371,6 +372,8 @@ FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) ...@@ -371,6 +372,8 @@ FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink)
static void lcd_implementation_status_screen() { static void lcd_implementation_status_screen() {
u8g.setColorIndex(1); // black on white u8g.setColorIndex(1); // black on white
bool blink = lcd_blink();
#if ENABLED(LASER) #if ENABLED(LASER)
#if ENABLED(LASER_PERIPHERALS) #if ENABLED(LASER_PERIPHERALS)
if (laser_peripherals_ok()) { if (laser_peripherals_ok()) {
...@@ -391,7 +394,13 @@ static void lcd_implementation_status_screen() { ...@@ -391,7 +394,13 @@ static void lcd_implementation_status_screen() {
#else #else
// Symbols menu graphics, animated fan // Symbols menu graphics, animated fan
u8g.drawBitmapP(9, 1, STATUS_SCREENBYTEWIDTH, STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp); u8g.drawBitmapP(9, 1, STATUS_SCREENBYTEWIDTH, STATUS_SCREENHEIGHT,
#if HAS(FAN)
blink && fanSpeed ? status_screen0_bmp : status_screen1_bmp
#else
status_screen0_bmp
#endif
);
#endif #endif
// Status Menu Font for SD info, Heater status, Fan, XYZ // Status Menu Font for SD info, Heater status, Fan, XYZ
...@@ -536,7 +545,7 @@ static void lcd_implementation_status_screen() { ...@@ -536,7 +545,7 @@ static void lcd_implementation_status_screen() {
lcd_print(lcd_status_message); lcd_print(lcd_status_message);
#if HAS(LCD_POWER_SENSOR) #if HAS(LCD_POWER_SENSOR)
#if HAS(LCD_FILAMENT_SENSOR) #if HAS(LCD_FILAMENT_SENSOR)
else if (millis() < previous_lcd_status_ms + 10000) else if (PENDING(millis(), previous_lcd_status_ms + 10000UL))
#else #else
else else
#endif #endif
...@@ -631,7 +640,7 @@ static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const c ...@@ -631,7 +640,7 @@ static void _drawmenu_setting_edit_generic(bool isSelected, uint8_t row, const c
#define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data))) #define lcd_implementation_drawmenu_setting_edit_callback_long5(sel, row, pstr, pstr2, data, minValue, maxValue, callback) lcd_implementation_drawmenu_setting_edit_generic(sel, row, pstr, ftostr5(*(data)))
#define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF)) #define lcd_implementation_drawmenu_setting_edit_callback_bool(sel, row, pstr, pstr2, data, callback) lcd_implementation_drawmenu_setting_edit_generic_P(sel, row, pstr, (*(data))?PSTR(MSG_ON):PSTR(MSG_OFF))
void lcd_implementation_drawedit(const char* pstr, char* value) { void lcd_implementation_drawedit(const char* pstr, const char* value=NULL) {
uint8_t rows = 1; uint8_t rows = 1;
uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH; uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH;
uint8_t vallen = lcd_strlen(value); uint8_t vallen = lcd_strlen(value);
......
...@@ -78,7 +78,7 @@ int gumPreheatFanSpeed; ...@@ -78,7 +78,7 @@ int gumPreheatFanSpeed;
typedef void (*menuFunc_t)(); typedef void (*menuFunc_t)();
uint8_t lcd_status_message_level; 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) #if ENABLED(DOGLCD)
#include "dogm_lcd_implementation.h" #include "dogm_lcd_implementation.h"
...@@ -149,7 +149,7 @@ static void lcd_status_screen(); ...@@ -149,7 +149,7 @@ static void lcd_status_screen();
static void lcd_filament_change_resume_message(); static void lcd_filament_change_resume_message();
#endif #endif
#if HAS(LCD_CONTRAST) #if ENABLED(HAS_LCD_CONTRAST)
static void lcd_set_contrast(); static void lcd_set_contrast();
#endif #endif
...@@ -345,7 +345,7 @@ typedef struct { ...@@ -345,7 +345,7 @@ typedef struct {
#endif #endif
} menuPosition; } menuPosition;
menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */ menuFunc_t currentMenu = lcd_status_screen; // pointer to the currently active menu handler
menuPosition menu_history[10]; menuPosition menu_history[10];
uint8_t menu_history_depth = 0; uint8_t menu_history_depth = 0;
...@@ -366,11 +366,11 @@ enum LCDViewAction { ...@@ -366,11 +366,11 @@ enum LCDViewAction {
uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial) uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
//Variables used when editing values. // Variables used when editing values.
const char* editLabel; const char* editLabel;
void* editValue; void* editValue;
int32_t minEditValue, maxEditValue; int32_t minEditValue, maxEditValue;
menuFunc_t callbackFunc; menuFunc_t callbackFunc; // call this after editing
// place-holders for Ki and Kd edits // place-holders for Ki and Kd edits
float raw_Ki, raw_Kd; float raw_Ki, raw_Kd;
...@@ -392,7 +392,7 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const ui ...@@ -392,7 +392,7 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const ui
menu_history_depth = 0; menu_history_depth = 0;
} }
#if ENABLED(LCD_PROGRESS_BAR) #if ENABLED(LCD_PROGRESS_BAR)
// For LCD_PROGRESS_BAR re-initialize the custom characters // For LCD_PROGRESS_BAR re-initialize custom characters
lcd_set_custom_characters(menu == lcd_status_screen); lcd_set_custom_characters(menu == lcd_status_screen);
#endif #endif
} }
...@@ -448,7 +448,7 @@ static void lcd_status_screen() { ...@@ -448,7 +448,7 @@ static void lcd_status_screen() {
if (card.isFileOpen()) { if (card.isFileOpen()) {
// Expire the message when printing is active // Expire the message when printing is active
if (IS_SD_PRINTING) { if (IS_SD_PRINTING) {
if (ms >= expire_status_ms) { if (ELAPSED(ms, expire_status_ms)) {
lcd_status_message[0] = '\0'; lcd_status_message[0] = '\0';
expire_status_ms = 0; expire_status_ms = 0;
} }
...@@ -470,14 +470,14 @@ static void lcd_status_screen() { ...@@ -470,14 +470,14 @@ static void lcd_status_screen() {
lcd_implementation_status_screen(); lcd_implementation_status_screen();
#if HAS(LCD_POWER_SENSOR) #if HAS(LCD_POWER_SENSOR)
if (millis() > print_millis + 2000) print_millis = millis(); if (ELAPSED(millis(), print_millis + 2000UL)) print_millis = millis();
#endif #endif
#if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR) #if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
#if HAS(LCD_FILAMENT_SENSOR) && HAS(LCD_POWER_SENSOR) #if HAS(LCD_FILAMENT_SENSOR) && HAS(LCD_POWER_SENSOR)
if (millis() > previous_lcd_status_ms + 15000) if (ELAPSED(millis(), previous_lcd_status_ms + 15000UL))
#else #else
if (millis() > previous_lcd_status_ms + 10000) if (ELAPSED(millis(), previous_lcd_status_ms + 10000UL))
#endif #endif
{ {
previous_lcd_status_ms = millis(); previous_lcd_status_ms = millis();
...@@ -630,10 +630,10 @@ static void lcd_autostart_sd() { ...@@ -630,10 +630,10 @@ static void lcd_autostart_sd() {
#endif #endif
/** /**
* *
* "Tune" submenu items * "Tune" submenu items
* *
*/ */
/** /**
* Set the home offset based on the current_position * Set the home offset based on the current_position
...@@ -646,44 +646,44 @@ lcd_return_to_status(); ...@@ -646,44 +646,44 @@ lcd_return_to_status();
#if ENABLED(BABYSTEPPING) #if ENABLED(BABYSTEPPING)
int babysteps_done = 0; int babysteps_done = 0;
static void _lcd_babystep(const int axis, const char* msg) {
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {
int distance = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR;
encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
#if MECH(COREXY) || MECH(COREYX)|| MECH(COREXZ) || MECH(COREZX)
#if ENABLED(BABYSTEP_XY)
switch(axis) {
case X_AXIS: // X on CoreXY, Core YX, CoreXZ and CoreZZ
babystepsTodo[A_AXIS] += distance * 2;
babystepsTodo[CORE_AXIS_2] += distance * 2;
break;
case CORE_AXIS_2: // Y on CoreXY and CoreYX, Z on CoreXZ and CoreZX
babystepsTodo[A_AXIS] += distance * 2;
babystepsTodo[CORE_AXIS_2] -= distance * 2;
break;
case CORE_AXIS_3: // Z on CoreXY and CoreYX, Y on CoreXZ and CoreZX
babystepsTodo[CORE_AXIS_3] += distance;
break;
}
#elif MECH(COREXZ) || MECH(COREZX)
babystepsTodo[A_AXIS] += distance * 2;
babystepsTodo[C_AXIS] -= distance * 2;
#else
babystepsTodo[Z_AXIS] += distance;
#endif
#else
babystepsTodo[axis] += distance;
#endif
babysteps_done += distance; static void _lcd_babystep(const AxisEnum axis, const char* msg) {
} ENCODER_DIRECTION_NORMAL();
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, itostr3sign(babysteps_done)); if (encoderPosition) {
if (LCD_CLICKED) lcd_goto_previous_menu(true); int distance = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR;
} encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
#if MECH(COREXY) || MECH(COREYX)|| MECH(COREXZ) || MECH(COREZX)
#if ENABLED(BABYSTEP_XY)
switch(axis) {
case X_AXIS: // X on CoreXY, Core YX, CoreXZ and CoreZZ
babystepsTodo[A_AXIS] += distance * 2;
babystepsTodo[CORE_AXIS_2] += distance * 2;
break;
case CORE_AXIS_2: // Y on CoreXY and CoreYX, Z on CoreXZ and CoreZX
babystepsTodo[A_AXIS] += distance * 2;
babystepsTodo[CORE_AXIS_2] -= distance * 2;
break;
case CORE_AXIS_3: // Z on CoreXY and CoreYX, Y on CoreXZ and CoreZX
babystepsTodo[CORE_AXIS_3] += distance;
break;
}
#elif MECH(COREXZ) || MECH(COREZX)
babystepsTodo[A_AXIS] += distance * 2;
babystepsTodo[C_AXIS] -= distance * 2;
#else
babystepsTodo[Z_AXIS] += distance;
#endif
#else
babystepsTodo[axis] += distance;
#endif
babysteps_done += distance;
}
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, itostr3sign(babysteps_done));
if (LCD_CLICKED) lcd_goto_previous_menu(true);
}
#if ENABLED(BABYSTEP_XY) #if ENABLED(BABYSTEP_XY)
static void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); } static void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
...@@ -1726,7 +1726,7 @@ static void lcd_control_volumetric_menu() { ...@@ -1726,7 +1726,7 @@ static void lcd_control_volumetric_menu() {
lcd_contrast &= 0x3F; lcd_contrast &= 0x3F;
#endif #endif
encoderPosition = 0; encoderPosition = 0;
lcdDrawUpdate = 1; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
u8g.setContrast(lcd_contrast); u8g.setContrast(lcd_contrast);
} }
if (lcdDrawUpdate) { if (lcdDrawUpdate) {
...@@ -1949,8 +1949,6 @@ static void laser_set_focus(float f_length) { ...@@ -1949,8 +1949,6 @@ static void laser_set_focus(float f_length) {
static void lcd_filament_change_resume_print() { static void lcd_filament_change_resume_print() {
filament_change_menu_response = FILAMENT_CHANGE_RESPONSE_RESUME_PRINT; filament_change_menu_response = FILAMENT_CHANGE_RESPONSE_RESUME_PRINT;
lcdDrawUpdate = 2;
lcd_goto_menu(lcd_status_screen);
} }
static void lcd_filament_change_extrude_more() { static void lcd_filament_change_extrude_more() {
...@@ -2023,6 +2021,7 @@ static void laser_set_focus(float f_length) { ...@@ -2023,6 +2021,7 @@ static void laser_set_focus(float f_length) {
switch (message) { switch (message) {
case FILAMENT_CHANGE_MESSAGE_INIT: case FILAMENT_CHANGE_MESSAGE_INIT:
defer_return_to_status = true; defer_return_to_status = true;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
lcd_goto_menu(lcd_filament_change_init_message); lcd_goto_menu(lcd_filament_change_init_message);
break; break;
case FILAMENT_CHANGE_MESSAGE_UNLOAD: case FILAMENT_CHANGE_MESSAGE_UNLOAD:
...@@ -2046,6 +2045,7 @@ static void laser_set_focus(float f_length) { ...@@ -2046,6 +2045,7 @@ static void laser_set_focus(float f_length) {
lcd_goto_menu(lcd_filament_change_resume_message); lcd_goto_menu(lcd_filament_change_resume_message);
break; break;
case FILAMENT_CHANGE_MESSAGE_STATUS: case FILAMENT_CHANGE_MESSAGE_STATUS:
lcd_implementation_clear();
lcd_return_to_status(); lcd_return_to_status();
break; break;
} }
...@@ -2179,7 +2179,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01) ...@@ -2179,7 +2179,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01)
#endif #endif
void lcd_quick_feedback() { void lcd_quick_feedback() {
lcdDrawUpdate = 2; lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
next_button_update_ms = millis() + 500; next_button_update_ms = millis() + 500;
#if ENABLED(LCD_USE_I2C_BUZZER) #if ENABLED(LCD_USE_I2C_BUZZER)
...@@ -2349,11 +2349,30 @@ bool lcd_blink() { ...@@ -2349,11 +2349,30 @@ bool lcd_blink() {
* - Act on RepRap World keypad input * - Act on RepRap World keypad input
* - Update the encoder position * - Update the encoder position
* - Apply acceleration to the encoder position * - Apply acceleration to the encoder position
* - Set lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NOW on controller events
* - Reset the Info Screen timeout if there's any input * - Reset the Info Screen timeout if there's any input
* - Update status indicators, if any * - Update status indicators, if any
* - Clear the LCD if lcdDrawUpdate == 2
* *
* Warning: This function is called from interrupt context! * Run the current LCD menu handler callback function:
* - Call the handler only if lcdDrawUpdate != LCDVIEW_NONE
* - Before calling the handler, LCDVIEW_CALL_NO_REDRAW => LCDVIEW_NONE
* - Call the menu handler. Menu handlers should do the following:
* - If a value changes, set lcdDrawUpdate to LCDVIEW_REDRAW_NOW and draw the value
* (Encoder events automatically set lcdDrawUpdate for you.)
* - if (lcdDrawUpdate) { redraw }
* - Before exiting the handler set lcdDrawUpdate to:
* - LCDVIEW_CLEAR_CALL_REDRAW to clear screen and set LCDVIEW_CALL_REDRAW_NEXT.
* - LCDVIEW_REDRAW_NOW or LCDVIEW_NONE to keep drawingm but only in this loop.
* - LCDVIEW_REDRAW_NEXT to keep drawing and draw on the next loop also.
* - LCDVIEW_CALL_NO_REDRAW to keep drawing (or start drawing) with no redraw on the next loop.
* - NOTE: For graphical displays menu handlers may be called 2 or more times per loop,
* so don't change lcdDrawUpdate without considering this.
*
* After the menu handler callback runs (or not):
* - Clear the LCD if lcdDrawUpdate == LCDVIEW_CLEAR_CALL_REDRAW
* - Update lcdDrawUpdate for the next loop (i.e., move one state down, usually)
*
* No worries. This function is only called from the main thread.
*/ */
void lcd_update() { void lcd_update() {
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0) #define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
#define BUTTON_PRESSED(BN) !READ(BTN_## BN) #define BUTTON_PRESSED(BN) !READ(BTN_## BN)
int lcd_strlen(const char* s); int lcd_strlen(const char* s);
int lcd_strlen_P(const char* s); int lcd_strlen_P(const char* s);
void lcd_update(); void lcd_update();
...@@ -106,6 +106,7 @@ ...@@ -106,6 +106,7 @@
bool lcd_blink(); bool lcd_blink();
#if ENABLED(ULTIPANEL) && ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(ULTIPANEL) && ENABLED(REPRAPWORLD_KEYPAD)
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
#define BLEN_REPRAPWORLD_KEYPAD_F3 0 #define BLEN_REPRAPWORLD_KEYPAD_F3 0
...@@ -133,6 +134,7 @@ ...@@ -133,6 +134,7 @@
#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_MIDDLE) #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_MIDDLE)
#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP)
#define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT) #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)
#endif // ULTIPANEL && REPRAPWORLD_KEYPAD #endif // ULTIPANEL && REPRAPWORLD_KEYPAD
#if ENABLED(NEWPANEL) #if ENABLED(NEWPANEL)
......
...@@ -1353,13 +1353,19 @@ void digipot_init() { ...@@ -1353,13 +1353,19 @@ void digipot_init() {
#endif #endif
#if MB(ALLIGATOR) #if MB(ALLIGATOR)
unsigned int digipot_motor = 0; set_driver_current();
#endif // MB(ALLIGATOR)
}
#if MB(ALLIGATOR)
void set_driver_current() {
uint8_t digipot_motor = 0;
for (uint8_t i = 0; i < 3 + DRIVER_EXTRUDERS; i++) { for (uint8_t i = 0; i < 3 + DRIVER_EXTRUDERS; i++) {
digipot_motor = 255 * motor_current[i] / 3.3; digipot_motor = 255 * motor_current[i] / 3.3;
ExternalDac::setValue(i, digipot_motor); ExternalDac::setValue(i, digipot_motor);
} }
#endif//MB(ALLIGATOR) }
} #endif
void digipot_current(uint8_t driver, int current) { void digipot_current(uint8_t driver, int current) {
#if HAS(DIGIPOTSS) #if HAS(DIGIPOTSS)
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
...@@ -120,4 +120,8 @@ ...@@ -120,4 +120,8 @@
void colorstep(long csteps, const bool direction); void colorstep(long csteps, const bool direction);
#endif #endif
#if MB(ALLIGATOR)
extern void set_driver_current();
#endif
#endif // STEPPER_H #endif // STEPPER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment