Commit fc4ef25c authored by MagoKimbra's avatar MagoKimbra

Fix

parent 4a191428
......@@ -1397,9 +1397,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)
/***********************************************************************/
......
......@@ -450,21 +450,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)
......@@ -472,55 +466,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
}
......
......@@ -261,7 +261,7 @@ double printer_usage_filament;
#endif
#if MB(ALLIGATOR)
float motor_current[DRIVER_EXTRUDERS + 3];
float motor_current[3 + DRIVER_EXTRUDERS];
#endif
#if ENABLED(COLOR_MIXING_EXTRUDER)
......@@ -665,7 +665,7 @@ bool enqueue_and_echo_command(const char* cmd, bool say_ok/*=false*/) {
*/
void setup() {
#if MB(ALLIGATOR)
setup_alligator_board();// Initialize Alligator Board
setup_alligator_board(); // Initialize Alligator Board
#endif
#if HAS(KILL)
setup_killpin();
......@@ -1068,7 +1068,7 @@ bool code_seen(char code) {
*
* Returns TRUE if the target is invalid
*/
bool setTargetedExtruder(int code) {
bool get_target_extruder_from_command(int code) {
if (code_seen('T')) {
short t = code_value_short();
if (t >= EXTRUDERS) {
......@@ -1089,7 +1089,7 @@ bool setTargetedExtruder(int code) {
*
* Returns TRUE if the target is invalid
*/
bool setTargetedHotend(int code) {
bool get_target_hotend_from_command(int code) {
if (code_seen('H')) {
short h = code_value_short();
if (h >= HOTENDS) {
......@@ -5146,7 +5146,7 @@ inline void gcode_M85() {
* M92: Set axis_steps_per_unit
*/
inline void gcode_M92() {
if (setTargetedExtruder(92)) return;
if (get_target_extruder_from_command(92)) return;
for(uint8_t i = 0; i < NUM_AXIS; i++) {
if (code_seen(axis_codes[i])) {
......@@ -5387,7 +5387,7 @@ inline void gcode_M92() {
* M104: Set hotend temperature
*/
inline void gcode_M104() {
if (setTargetedExtruder(104)) return;
if (get_target_extruder_from_command(104)) return;
if (DEBUGGING(DRYRUN)) return;
#if HOTENDS == 1
......@@ -5426,7 +5426,7 @@ inline void gcode_M104() {
* M105: Read hot end and bed temperature
*/
inline void gcode_M105() {
if (setTargetedExtruder(105)) return;
if (get_target_extruder_from_command(105)) return;
#if HAS(TEMP_0) || HAS(TEMP_BED) || ENABLED(HEATER_0_USES_MAX6675)
ECHO_S(OK);
......@@ -5456,7 +5456,7 @@ inline void gcode_M105() {
* Rxxx Wait for extruder(s) to reach temperature. Waits when heating and cooling.
*/
inline void gcode_M109() {
if (setTargetedExtruder(109)) return;
if (get_target_extruder_from_command(109)) return;
if (DEBUGGING(DRYRUN)) return;
#if HOTENDS == 1
......@@ -5801,7 +5801,7 @@ inline void gcode_M140() {
*/
inline void gcode_M200() {
if (setTargetedExtruder(200)) return;
if (get_target_extruder_from_command(200)) return;
if (code_seen('D')) {
float diameter = code_value();
......@@ -5861,7 +5861,7 @@ inline void gcode_M201() {
*
*/
inline void gcode_M203() {
if (setTargetedExtruder(203)) return;
if (get_target_extruder_from_command(203)) return;
for(uint8_t i = 0; i < NUM_AXIS; i++) {
if (code_seen(axis_codes[i])) {
......@@ -5883,7 +5883,7 @@ inline void gcode_M203() {
* Also sets minimum segment time in ms (B20000) to prevent buffer under-runs and M20 minimum feedrate
*/
inline void gcode_M204() {
if (setTargetedExtruder(204)) return;
if (get_target_extruder_from_command(204)) return;
if (code_seen('S')) { // Kept for legacy compatibility. Should NOT BE USED for new developments.
acceleration = code_value();
......@@ -5915,7 +5915,7 @@ inline void gcode_M204() {
* E = Max E Jerk (mm/s/s)
*/
inline void gcode_M205() {
if (setTargetedExtruder(205)) return;
if (get_target_extruder_from_command(205)) return;
if (code_seen('S')) minimumfeedrate = code_value();
if (code_seen('V')) mintravelfeedrate = code_value();
......@@ -6003,7 +6003,7 @@ inline void gcode_M206() {
* M218 - set hotend offset (in mm), H<hotend_number> X<offset_on_X> Y<offset_on_Y> Z<offset_on_Z>
*/
inline void gcode_M218() {
if (setTargetedHotend(218)) return;
if (get_target_hotend_from_command(218)) return;
if (code_seen('X')) hotend_offset[X_AXIS][target_extruder] = code_value();
if (code_seen('Y')) hotend_offset[Y_AXIS][target_extruder] = code_value();
......@@ -6029,7 +6029,7 @@ inline void gcode_M220() {
* M221: Set extrusion percentage (M221 T0 S95)
*/
inline void gcode_M221() {
if (setTargetedExtruder(221)) return;
if (get_target_extruder_from_command(221)) return;
if (code_seen('S')) extruder_multiplier[target_extruder] = code_value();
}
......@@ -6038,7 +6038,7 @@ inline void gcode_M221() {
* M222: Set density extrusion percentage (M222 T0 S95)
*/
inline void gcode_M222() {
if (setTargetedExtruder(222)) return;
if (get_target_extruder_from_command(222)) return;
if (code_seen('S')) {
density_multiplier[target_extruder] = code_value();
......@@ -6862,7 +6862,7 @@ inline void gcode_M503() {
* M522: Read or Write on card. M522 T<extruders> R<read> or W<write> L<list>
*/
inline void gcode_M522() {
if (setTargetedExtruder(522)) return;
if (get_target_extruder_from_command(522)) return;
if (!RFID_ON) return;
if (code_seen('R')) {
......@@ -6898,7 +6898,7 @@ inline void gcode_M503() {
* M595 - set Hotend AD595 offset & Gain H<hotend_number> O<offset> S<gain>
*/
inline void gcode_M595() {
if (setTargetedHotend(595)) return;
if (get_target_hotend_from_command(595)) return;
if (code_seen('O')) ad595_offset[target_extruder] = code_value();
if (code_seen('S')) ad595_gain[target_extruder] = code_value();
......@@ -7272,8 +7272,8 @@ inline void gcode_M503() {
* M906: Set motor currents
*/
inline void gcode_M906() {
if (setTargetedExtruder(906)) return;
for (uint8_t i = 0; i < 3 + DRIVER_EXTRUDERS; i++) {
if (get_target_extruder_from_command(906)) return;
for (uint8_t i = 0; i < NUM_AXIS; i++) {
if (code_seen(axis_codes[i])) {
if (i == E_AXIS)
motor_current[i + target_extruder] = code_value();
......@@ -7281,6 +7281,7 @@ inline void gcode_M503() {
motor_current[i] = code_value();
}
}
set_driver_current();
}
#endif // ALLIGATOR
......@@ -7340,11 +7341,21 @@ inline void gcode_M907() {
/**
* M999: Restart after being stopped
*
* Default behaviour is to flush the serial buffer and request
* a resend to the host starting on the last N line received.
*
* Sending "M999 S1" will resume printing without flushing the
* existing command buffer.
*
*/
inline void gcode_M999() {
Running = true;
Printing = false;
lcd_reset_alert_level();
if (code_seen('S') && code_value_short() == 1) return;
FlushSerialRequestResend();
}
......@@ -8293,7 +8304,7 @@ static void report_current_position() {
float difference[NUM_AXIS];
float addDistance[NUM_AXIS];
float fractions[NUM_AXIS];
float frfm = feedrate / 60 * feedrate_multiplier / 100.0;
float _feedrate = feedrate * feedrate_multiplier / 6000.0;
for (uint8_t i = 0; i < NUM_AXIS; i++) difference[i] = target[i] - current_position[i];
......@@ -8302,8 +8313,9 @@ static void report_current_position() {
if (cartesian_mm < 0.000001) return false;
#if ENABLED(DELTA_SEGMENTS_PER_SECOND)
float seconds = 6000 * cartesian_mm / feedrate / feedrate_multiplier;
float seconds = cartesian_mm / _feedrate;
int steps = max(1, int(DELTA_SEGMENTS_PER_SECOND * seconds));
float inv_steps = 1.0 / steps;
if (DEBUGGING(DEBUG)) {
ECHO_SMV(DEB, "mm=", cartesian_mm);
......@@ -8332,7 +8344,7 @@ static void report_current_position() {
for (int s = 1; s <= steps; s++) {
#if ENABLED(DELTA_SEGMENTS_PER_SECOND)
float fraction = float(s) / float(steps);
float fraction = float(s) * inv_steps;
for (uint8_t i = 0; i < NUM_AXIS; i++)
target[i] = current_position[i] + difference[i] * fraction;
#else
......@@ -8351,7 +8363,7 @@ static void report_current_position() {
DEBUG_POS("prepare_move_delta", delta);
}
plan_buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], target[E_AXIS], frfm, active_extruder, active_driver);
plan_buffer_line(delta[TOWER_1], delta[TOWER_2], delta[TOWER_3], target[E_AXIS], _feedrate, active_extruder, active_driver);
}
return true;
}
......@@ -8835,7 +8847,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
#endif
#if ENABLED(EXTRUDER_RUNOUT_PREVENT)
if (ELAPSED(ms, previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000UL))
if (ELAPSED(ms, previous_cmd_ms + (EXTRUDER_RUNOUT_SECONDS) * 1000UL)) {
if (degHotend(active_extruder) > EXTRUDER_RUNOUT_MINTEMP) {
bool oldstatus;
switch(active_extruder) {
......
......@@ -138,6 +138,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
......@@ -253,7 +259,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)
......@@ -273,19 +279,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.
//
......
......@@ -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)
......@@ -140,6 +141,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
......@@ -171,7 +173,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) {
......@@ -367,8 +368,16 @@ 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();
// 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
);
// Status Menu Font for SD info, Heater status, Fan, XYZ
lcd_setFont(FONT_STATUSMENU);
......@@ -510,7 +519,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
......@@ -605,7 +614,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"
......@@ -120,7 +120,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
......@@ -316,7 +316,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;
......@@ -337,11 +337,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;
......@@ -363,7 +363,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
}
......@@ -419,7 +419,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;
}
......@@ -441,14 +441,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();
......@@ -614,7 +614,7 @@ void lcd_set_home_offsets() {
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;
......@@ -1691,7 +1691,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) {
......@@ -1793,8 +1793,6 @@ static void lcd_control_volumetric_menu() {
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() {
......@@ -1867,6 +1865,7 @@ static void lcd_control_volumetric_menu() {
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:
......@@ -1890,6 +1889,7 @@ static void lcd_control_volumetric_menu() {
lcd_goto_menu(lcd_filament_change_resume_message);
break;
case FILAMENT_CHANGE_MESSAGE_STATUS:
lcd_implementation_clear();
lcd_return_to_status();
break;
}
......@@ -2023,7 +2023,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)
......@@ -2193,11 +2193,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)
......
......@@ -1245,13 +1245,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