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 @@
// Uncomment to include more info in ok command
//#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.
// Enable this option if your host doesn't like keepalive messages.
//#define DISABLE_HOST_KEEPALIVE
#define HOST_KEEPALIVE_FEATURE // Disable this if your host doesn't like keepalive messages
#define DEFAULT_KEEPALIVE_INTERVAL 2 // Number of seconds between "busy" messages. Set with M113.
/***********************************************************************/
......
......@@ -1494,9 +1494,9 @@
************************** Motor's current ****************************
***********************************************************************/
// 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)
#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 @@
#define E0E1_CHOICE_PIN -1
#define E0E2_CHOICE_PIN -1
#define E0E3_CHOICE_PIN -1
#define E0E4_CHOICE_PIN -1
#define E0E5_CHOICE_PIN -1
#define E1E3_CHOICE_PIN -1
#endif
......
......@@ -463,21 +463,15 @@ void Config_ResetDefault() {
float tmp3[] = DEFAULT_MAX_ACCELERATION;
float tmp4[] = DEFAULT_RETRACT_ACCELERATION;
float tmp5[] = DEFAULT_EJERK;
#if ENABLED(PIDTEMP)
float tmp6[] = DEFAULT_Kp;
float tmp7[] = DEFAULT_Ki;
float tmp8[] = DEFAULT_Kd;
float tmp9[] = DEFAULT_Kc;
#endif // PIDTEMP
#if ENABLED(HOTEND_OFFSET_X) && ENABLED(HOTEND_OFFSET_Y) && ENABLED(HOTEND_OFFSET_Z)
float tmp10[] = HOTEND_OFFSET_X;
float tmp11[] = HOTEND_OFFSET_Y;
float tmp12[] = HOTEND_OFFSET_Z;
#else
float tmp10[] = {0};
float tmp11[] = {0};
float tmp12[] = {0};
#endif
#if MB(ALLIGATOR)
......@@ -485,55 +479,30 @@ void Config_ResetDefault() {
#endif
for (int8_t i = 0; i < 3 + EXTRUDERS; i++) {
short max_i;
max_i = sizeof(tmp1) / sizeof(*tmp1);
if(i < max_i)
axis_steps_per_unit[i] = tmp1[i];
else
axis_steps_per_unit[i] = tmp1[max_i - 1];
max_i = sizeof(tmp2) / sizeof(*tmp2);
if(i < max_i)
max_feedrate[i] = tmp2[i];
else
max_feedrate[i] = tmp2[max_i - 1];
max_i = sizeof(tmp3) / sizeof(*tmp3);
if(i < max_i)
max_acceleration_units_per_sq_second[i] = tmp3[i];
else
max_acceleration_units_per_sq_second[i] = tmp3[max_i - 1];
if(i < EXTRUDERS) {
max_i = sizeof(tmp4) / sizeof(*tmp4);
if(i < max_i)
}
for (int8_t i = 0; i < EXTRUDERS; i++) {
retract_acceleration[i] = tmp4[i];
else
retract_acceleration[i] = tmp4[max_i - 1];
max_i = sizeof(tmp5) / sizeof(*tmp5);
if(i < max_i)
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)
}
#if MB(ALLIGATOR)
for (int8_t i = 0; i < 3 + DRIVER_EXTRUDERS; i++)
motor_current[i] = tmp13[i];
#endif
for (int8_t i = 0; i < HOTENDS; i++) {
#if ENABLED(HOTEND_OFFSET_X) && ENABLED(HOTEND_OFFSET_Y) && ENABLED(HOTEND_OFFSET_Z)
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
#else
hotend_offset[X_AXIS][i] = 0;
hotend_offset[Y_AXIS][i] = 0;
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
}
......
This diff is collapsed.
......@@ -139,6 +139,12 @@ extern bool axis_known_position[3];
extern bool axis_homed[3];
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)
extern int extruder_advance_k;
#endif
......@@ -254,7 +260,7 @@ extern uint8_t previous_extruder;
extern uint8_t active_driver;
#if MB(ALLIGATOR)
extern float motor_current[DRIVER_EXTRUDERS + 3];
extern float motor_current[3 + DRIVER_EXTRUDERS];
#endif
#if ENABLED(DIGIPOT_I2C)
......@@ -282,19 +288,12 @@ extern uint8_t active_driver;
extern float mixing_factor[DRIVER_EXTRUDERS];
#endif
extern void calculate_volumetric_multipliers();
void calculate_volumetric_multipliers();
#if ENABLED(M100_FREE_MEMORY_WATCHER)
extern void *__brkval;
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.
//
......
......@@ -475,10 +475,9 @@
#endif
/**
* Avoid double-negatives for enabling features
* Host keep alive
*/
#if DISABLED(DISABLE_HOST_KEEPALIVE)
#define HOST_KEEPALIVE_FEATURE
#if DISABLED(DEFAULT_KEEPALIVE_INTERVAL)
#define DEFAULT_KEEPALIVE_INTERVAL 2
#endif
......
......@@ -39,7 +39,8 @@
#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)
......@@ -144,6 +145,7 @@
// LCD selection
#if ENABLED(U8GLIB_ST7920)
//U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
U8GLIB_ST7920_128X64_RRD u8g(0);
#elif ENABLED(MAKRPANEL)
// The MaKrPanel display, ST7565 controller as well
......@@ -175,7 +177,6 @@
#include "utf_mapper.h"
int lcd_contrast;
static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
static char currentfont = 0;
static void lcd_setFont(char font_nr) {
......@@ -371,6 +372,8 @@ FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink)
static void lcd_implementation_status_screen() {
u8g.setColorIndex(1); // black on white
bool blink = lcd_blink();
#if ENABLED(LASER)
#if ENABLED(LASER_PERIPHERALS)
if (laser_peripherals_ok()) {
......@@ -391,7 +394,13 @@ static void lcd_implementation_status_screen() {
#else
// 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
// Status Menu Font for SD info, Heater status, Fan, XYZ
......@@ -536,7 +545,7 @@ static void lcd_implementation_status_screen() {
lcd_print(lcd_status_message);
#if HAS(LCD_POWER_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
#endif
......@@ -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_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 lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH;
uint8_t vallen = lcd_strlen(value);
......
......@@ -78,7 +78,7 @@ int gumPreheatFanSpeed;
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"
......@@ -149,7 +149,7 @@ static void lcd_status_screen();
static void lcd_filament_change_resume_message();
#endif
#if HAS(LCD_CONTRAST)
#if ENABLED(HAS_LCD_CONTRAST)
static void lcd_set_contrast();
#endif
......@@ -345,7 +345,7 @@ typedef struct {
#endif
} 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];
uint8_t menu_history_depth = 0;
......@@ -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)
//Variables used when editing values.
// Variables used when editing values.
const char* editLabel;
void* editValue;
int32_t minEditValue, maxEditValue;
menuFunc_t callbackFunc;
menuFunc_t callbackFunc; // call this after editing
// place-holders for Ki and Kd edits
float raw_Ki, raw_Kd;
......@@ -392,7 +392,7 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const ui
menu_history_depth = 0;
}
#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);
#endif
}
......@@ -448,7 +448,7 @@ static void lcd_status_screen() {
if (card.isFileOpen()) {
// Expire the message when printing is active
if (IS_SD_PRINTING) {
if (ms >= expire_status_ms) {
if (ELAPSED(ms, expire_status_ms)) {
lcd_status_message[0] = '\0';
expire_status_ms = 0;
}
......@@ -470,14 +470,14 @@ static void lcd_status_screen() {
lcd_implementation_status_screen();
#if HAS(LCD_POWER_SENSOR)
if (millis() > print_millis + 2000) print_millis = millis();
if (ELAPSED(millis(), print_millis + 2000UL)) print_millis = millis();
#endif
#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
if (millis() > previous_lcd_status_ms + 10000)
if (ELAPSED(millis(), previous_lcd_status_ms + 10000UL))
#endif
{
previous_lcd_status_ms = millis();
......@@ -630,10 +630,10 @@ static void lcd_autostart_sd() {
#endif
/**
*
* "Tune" submenu items
*
*/
*
* "Tune" submenu items
*
*/
/**
* Set the home offset based on the current_position
......@@ -646,9 +646,9 @@ lcd_return_to_status();
#if ENABLED(BABYSTEPPING)
int babysteps_done = 0;
int babysteps_done = 0;
static void _lcd_babystep(const int axis, const char* msg) {
static void _lcd_babystep(const AxisEnum axis, const char* msg) {
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {
int distance = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR;
......@@ -683,7 +683,7 @@ static void _lcd_babystep(const int axis, const char* msg) {
}
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, itostr3sign(babysteps_done));
if (LCD_CLICKED) lcd_goto_previous_menu(true);
}
}
#if ENABLED(BABYSTEP_XY)
static void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEPPING_X)); }
......@@ -1726,7 +1726,7 @@ static void lcd_control_volumetric_menu() {
lcd_contrast &= 0x3F;
#endif
encoderPosition = 0;
lcdDrawUpdate = 1;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
u8g.setContrast(lcd_contrast);
}
if (lcdDrawUpdate) {
......@@ -1949,8 +1949,6 @@ static void laser_set_focus(float f_length) {
static void lcd_filament_change_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() {
......@@ -2023,6 +2021,7 @@ static void laser_set_focus(float f_length) {
switch (message) {
case FILAMENT_CHANGE_MESSAGE_INIT:
defer_return_to_status = true;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
lcd_goto_menu(lcd_filament_change_init_message);
break;
case FILAMENT_CHANGE_MESSAGE_UNLOAD:
......@@ -2046,6 +2045,7 @@ static void laser_set_focus(float f_length) {
lcd_goto_menu(lcd_filament_change_resume_message);
break;
case FILAMENT_CHANGE_MESSAGE_STATUS:
lcd_implementation_clear();
lcd_return_to_status();
break;
}
......@@ -2179,7 +2179,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01)
#endif
void lcd_quick_feedback() {
lcdDrawUpdate = 2;
lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW;
next_button_update_ms = millis() + 500;
#if ENABLED(LCD_USE_I2C_BUZZER)
......@@ -2349,11 +2349,30 @@ bool lcd_blink() {
* - Act on RepRap World keypad input
* - Update 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
* - 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() {
#if ENABLED(ULTIPANEL)
......
......@@ -106,6 +106,7 @@
bool lcd_blink();
#if ENABLED(ULTIPANEL) && ENABLED(REPRAPWORLD_KEYPAD)
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
#define BLEN_REPRAPWORLD_KEYPAD_F3 0
......@@ -133,6 +134,7 @@
#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_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT)
#endif // ULTIPANEL && REPRAPWORLD_KEYPAD
#if ENABLED(NEWPANEL)
......
......@@ -1353,13 +1353,19 @@ void digipot_init() {
#endif
#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++) {
digipot_motor = 255 * motor_current[i] / 3.3;
ExternalDac::setValue(i, digipot_motor);
}
#endif//MB(ALLIGATOR)
}
}
#endif
void digipot_current(uint8_t driver, int current) {
#if HAS(DIGIPOTSS)
......
......@@ -120,4 +120,8 @@
void colorstep(long csteps, const bool direction);
#endif
#if MB(ALLIGATOR)
extern void set_driver_current();
#endif
#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