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
float tmp6[] = DEFAULT_Kp;
float tmp7[] = DEFAULT_Ki;
float tmp8[] = DEFAULT_Kd;
float tmp9[] = DEFAULT_Kc;
#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)
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)
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];
axis_steps_per_unit[i] = tmp1[i];
max_feedrate[i] = tmp2[i];
max_acceleration_units_per_sq_second[i] = tmp3[i];
}
for (int8_t i = 0; i < EXTRUDERS; i++) {
retract_acceleration[i] = tmp4[i];
max_e_jerk[i] = tmp5[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];
hotend_offset[Y_AXIS][i] = tmp11[i];
hotend_offset[Z_AXIS][i] = tmp12[i];
#else
hotend_offset[X_AXIS][i] = 0;
hotend_offset[Y_AXIS][i] = 0;
hotend_offset[Z_AXIS][i] = 0;
#endif
}
......
......@@ -12,11 +12,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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/>.
*
*/
......
......@@ -266,7 +266,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)
......@@ -590,8 +590,10 @@ bool enqueue_and_echo_command(const char* cmd, bool say_ok/*=false*/) {
#if HAS(DONDOLO)
servo[DONDOLO_SERVO_INDEX].attach(0);
servo[DONDOLO_SERVO_INDEX].write(DONDOLO_SERVOPOS_E0);
delay_ms(DONDOLO_SERVO_DELAY);
servo[DONDOLO_SERVO_INDEX].detach();
#if (DONDOLO_SERVO_DELAY > 0)
delay_ms(DONDOLO_SERVO_DELAY);
servo[DONDOLO_SERVO_INDEX].detach();
#endif
#endif
// Set position of Servo Endstops that are defined
......@@ -668,7 +670,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();
......@@ -1083,7 +1085,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) {
......@@ -1104,7 +1106,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) {
......@@ -3940,8 +3942,10 @@ inline void gcode_G28() {
#elif ENABLED(Z_SAFE_HOMING)
if (home_all_axis || homeZ) {
if (DEBUGGING(INFO)) ECHO_LM(INFO, "> Z_SAFE_HOMING >>>");
// Let's see if X and Y are homed
if (axis_was_homed & (_BV(X_AXIS)|_BV(Y_AXIS)) == (_BV(X_AXIS)|_BV(Y_AXIS))) {
if (axis_homed[X_AXIS] && axis_homed[Y_AXIS]) {
current_position[Z_AXIS] = 0;
sync_plan_position();
......@@ -3951,7 +3955,6 @@ inline void gcode_G28() {
feedrate = xy_travel_speed;
if (DEBUGGING(INFO)) {
ECHO_SMV(INFO, "Raise Z (before homing) by ", (float)Z_RAISE_BEFORE_HOMING);
DEBUG_POS(" > home_all_axis", current_position);
DEBUG_POS(" > home_all_axis", destination);
}
......@@ -5500,7 +5503,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])) {
......@@ -5741,7 +5744,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
......@@ -5780,7 +5783,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) || HAS(TEMP_COOLER) || ENABLED(FLOWMETER_SENSOR)
ECHO_S(OK);
......@@ -5818,7 +5821,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
......@@ -6187,7 +6190,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();
......@@ -6247,7 +6250,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])) {
......@@ -6269,7 +6272,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();
......@@ -6301,7 +6304,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();
......@@ -6389,7 +6392,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();
......@@ -6415,7 +6418,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();
}
......@@ -6424,7 +6427,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();
......@@ -6537,8 +6540,10 @@ inline void gcode_M226() {
Servo *srv = &servo[servo_index];
srv->attach(0);
srv->write(servo_position);
delay_ms(DONDOLO_SERVO_DELAY);
srv->detach();
#if (DONDOLO_SERVO_DELAY > 0)
delay_ms(DONDOLO_SERVO_DELAY);
srv->detach();
#endif
}
else {
ECHO_SM(ER, "Servo ");
......@@ -7266,7 +7271,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')) {
......@@ -7302,7 +7307,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();
......@@ -7736,8 +7741,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();
......@@ -7745,6 +7750,7 @@ inline void gcode_M503() {
motor_current[i] = code_value();
}
}
set_driver_current();
}
#endif // ALLIGATOR
......@@ -7804,11 +7810,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();
}
......@@ -8070,8 +8086,10 @@ inline void gcode_T(uint8_t tmp_extruder) {
else if (target_extruder == 1) {
servo[DONDOLO_SERVO_INDEX].write(DONDOLO_SERVOPOS_E1);
}
delay_ms(DONDOLO_SERVO_DELAY);
servo[DONDOLO_SERVO_INDEX].detach();
#if (DONDOLO_SERVO_DELAY > 0)
delay_ms(DONDOLO_SERVO_DELAY);
servo[DONDOLO_SERVO_INDEX].detach();
#endif
previous_extruder = active_extruder;
#if ENABLED(DONDOLO_SINGLE_MOTOR)
active_extruder = target_extruder;
......@@ -8785,7 +8803,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];
......@@ -8794,8 +8812,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);
......@@ -8824,7 +8843,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
......@@ -8843,7 +8862,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;
}
......@@ -9359,7 +9378,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) {
......
......@@ -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
......
......@@ -12,11 +12,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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 @@
#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,44 +646,44 @@ lcd_return_to_status();
#if ENABLED(BABYSTEPPING)
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
int babysteps_done = 0;
babysteps_done += distance;
}
if (lcdDrawUpdate) lcd_implementation_drawedit(msg, itostr3sign(babysteps_done));
if (LCD_CLICKED) lcd_goto_previous_menu(true);
}
static void _lcd_babystep(const AxisEnum 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;
}
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)
......
......@@ -12,11 +12,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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 @@
#define BUTTON_EXISTS(BN) (defined(BTN_## BN) && BTN_## BN >= 0)
#define BUTTON_PRESSED(BN) !READ(BTN_## BN)
int lcd_strlen(const char* s);
int lcd_strlen_P(const char* s);
void lcd_update();
......@@ -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)
......
......@@ -12,11 +12,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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/>.
*
*/
......@@ -25,14 +25,9 @@
/**
* Implementation of the LCD display routines for a Hitachi HD44780 display. These are common LCD character displays.
* When selecting the Russian language, a slightly different LCD implementation is used to handle UTF8 characters.
**/
//#if DISABLED(REPRAPWORLD_KEYPAD)
// extern volatile uint8_t buttons; //the last checked buttons in a bit array.
//#else
extern volatile uint8_t buttons; //an extended version of the last checked buttons in a bit array.
//#endif
extern volatile uint8_t buttons; //an extended version of the last checked buttons in a bit array.
////////////////////////////////////
// Setup button and encode mappings for each panel (into 'buttons' variable
......@@ -49,13 +44,13 @@
#define EN_B (_BV(BLEN_B)) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
#define EN_A (_BV(BLEN_A))
#if defined(BTN_ENC) && BTN_ENC > -1
#if BUTTON_EXISTS(ENC)
// encoder click is directly connected
#define BLEN_C 2
#define EN_C (_BV(BLEN_C))
#endif
#if ENABLED(BTN_BACK) && BTN_BACK > 0
#if BUTTON_EXISTS(BTN_BACK)
#define BLEN_D 3
#define EN_D (_BV(BLEN_D))
#endif
......@@ -73,16 +68,17 @@
#define B_DW (BUTTON_DOWN<<B_I2C_BTN_OFFSET)
#define B_RI (BUTTON_RIGHT<<B_I2C_BTN_OFFSET)
#if ENABLED(BTN_ENC) && BTN_ENC > -1
#if BUTTON_EXISTS(ENC)
// the pause/stop/restart button is connected to BTN_ENC when used
#define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name
#undef LCD_CLICKED
#if ENABLED(INVERT_CLICK_BUTTON)
#define LCD_CLICKED !(buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
#else
#define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
#endif
#else
#undef LCD_CLICKED
#if ENABLED(INVERT_CLICK_BUTTON)
#define LCD_CLICKED !(buttons&(B_MI|B_RI))
#else
......@@ -94,12 +90,23 @@
#define LCD_HAS_SLOW_BUTTONS
#elif ENABLED(LCD_I2C_PANELOLU2)
// encoder click can be read through I2C if not directly connected
#if BTN_ENC <= 0
#if BUTTON_EXISTS(ENC)
#undef LCD_CLICKED
#if ENABLED(INVERT_CLICK_BUTTON)
#define LCD_CLICKED !(buttons&EN_C)
#else
#define LCD_CLICKED (buttons&EN_C)
#endif
#else // Read through I2C if not directly connected to a pin
#define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
#define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
#undef LCD_CLICKED
#if ENABLED(INVERT_CLICK_BUTTON)
#define LCD_CLICKED !(buttons&B_MI)
#else
......@@ -108,46 +115,12 @@
// I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
#define LCD_HAS_SLOW_BUTTONS
#else
#if ENABLED(INVERT_CLICK_BUTTON)
#define LCD_CLICKED !(buttons&EN_C)
#else
#define LCD_CLICKED (buttons&EN_C)
#endif
#endif
#elif ENABLED(REPRAPWORLD_KEYPAD)
// define register bit values, don't change it
#define BLEN_REPRAPWORLD_KEYPAD_F3 0
#define BLEN_REPRAPWORLD_KEYPAD_F2 1
#define BLEN_REPRAPWORLD_KEYPAD_F1 2
#define BLEN_REPRAPWORLD_KEYPAD_UP 6
#define BLEN_REPRAPWORLD_KEYPAD_RIGHT 4
#define BLEN_REPRAPWORLD_KEYPAD_MIDDLE 5
#define BLEN_REPRAPWORLD_KEYPAD_DOWN 3
#define BLEN_REPRAPWORLD_KEYPAD_LEFT 7
#define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
#define EN_REPRAPWORLD_KEYPAD_F3 (_BV(BLEN_REPRAPWORLD_KEYPAD_F3+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F2 (_BV(BLEN_REPRAPWORLD_KEYPAD_F2+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_F1 (_BV(BLEN_REPRAPWORLD_KEYPAD_F1+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_UP (_BV(BLEN_REPRAPWORLD_KEYPAD_UP+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_RIGHT (_BV(BLEN_REPRAPWORLD_KEYPAD_RIGHT+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_MIDDLE (_BV(BLEN_REPRAPWORLD_KEYPAD_MIDDLE+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_DOWN (_BV(BLEN_REPRAPWORLD_KEYPAD_DOWN+REPRAPWORLD_BTN_OFFSET))
#define EN_REPRAPWORLD_KEYPAD_LEFT (_BV(BLEN_REPRAPWORLD_KEYPAD_LEFT+REPRAPWORLD_BTN_OFFSET))
/*
#if ENABLED(INVERT_CLICK_BUTTON)
#define LCD_CLICKED !((buttons&EN_C) || (buttons&EN_REPRAPWORLD_KEYPAD_F1))
#else
#define LCD_CLICKED ((buttons&EN_C) || (buttons&EN_REPRAPWORLD_KEYPAD_F1))
#endif
*/
//#define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons&EN_REPRAPWORLD_KEYPAD_DOWN)
//#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP)
//#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE)
// REPRAPWORLD_KEYPAD defined in ultralcd.h
#elif ENABLED(NEWPANEL)
#if ENABLED(INVERT_CLICK_BUTTON)
......@@ -249,6 +222,12 @@
#include <LiquidCrystal_SR.h>
#define LCD_CLASS LiquidCrystal_SR
LCD_CLASS lcd(SR_DATA_PIN, SR_CLK_PIN);
#elif ENABLED(LCM1602)
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define LCD_CLASS LiquidCrystal_I2C
LCD_CLASS lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
#else
// Standard directly connected LCD implementations
#include <LiquidCrystal.h>
......@@ -271,6 +250,10 @@
#define LCD_STR_PROGRESS "\x03\x04\x05"
#endif
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
static void lcd_implementation_update_indicators();
#endif
static void lcd_set_custom_characters(
#if ENABLED(LCD_PROGRESS_BAR)
bool progress_bar_set = true
......@@ -484,6 +467,7 @@ char lcd_print(const char* str) {
unsigned lcd_print(char c) { return charset_mapper(c); }
#if ENABLED(SHOW_BOOTSCREEN)
void lcd_erase_line(int line) {
lcd.setCursor(0, line);
for (int i = 0; i < LCD_WIDTH; i++)
......@@ -502,6 +486,13 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
}
}
static void logo_lines(const char *extra) {
int indent = (LCD_WIDTH - 8 - lcd_strlen_P(extra)) / 2;
lcd.setCursor(indent, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------------" )); lcd.print('\x01');
lcd.setCursor(indent, 1); lcd_printPGM(PSTR("|MarlinKimbra|")); lcd_printPGM(extra);
lcd.setCursor(indent, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------------" )); lcd.print('\x03');
}
static void bootscreen() {
show_bootscreen = false;
byte top_left[8] = {
......@@ -551,28 +542,72 @@ unsigned lcd_print(char c) { return charset_mapper(c); }
lcd.clear();
#define TEXT_SCREEN_LOGO_SHIFT ((LCD_WIDTH/2) - 7)
lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 0); lcd.print('\x00'); lcd_printPGM(PSTR( "------------" )); lcd.print('\x01');
lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 1); lcd_printPGM(PSTR("|MarlinKimbra|"));
lcd.setCursor(TEXT_SCREEN_LOGO_SHIFT, 2); lcd.print('\x02'); lcd_printPGM(PSTR( "------------" )); lcd.print('\x03');
delay(1000);
#ifdef STRING_SPLASH_LINE1
lcd_erase_line(3);
lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE1), LCD_WIDTH, 3000);
#endif
#define LCD_EXTRA_SPACE (LCD_WIDTH-8)
#define CENTER_OR_SCROLL(STRING,DELAY) \
lcd_erase_line(3); \
if (strlen(STRING) <= LCD_WIDTH) { \
lcd.setCursor((LCD_WIDTH - lcd_strlen_P(PSTR(STRING))) / 2, 3); \
lcd_printPGM(PSTR(STRING)); \
HAL::delayMilliseconds(DELAY); \
} \
else { \
lcd_scroll(0, 3, PSTR(STRING), LCD_WIDTH, DELAY); \
}
#ifdef STRING_SPLASH_LINE2
lcd_erase_line(3);
lcd_scroll(0, 3, PSTR(STRING_SPLASH_LINE2), LCD_WIDTH, 3000);
#if ENABLED(STRING_SPLASH_LINE1)
//
// Show the MarlinKimbra logo with splash line 1
//
if (LCD_EXTRA_SPACE >= strlen(STRING_SPLASH_LINE1) + 1) {
//
// Show the Marlin logo, splash line1, and splash line 2
//
logo_lines(PSTR(STRING_SPLASH_LINE1));
#if ENABLED(STRING_SPLASH_LINE2)
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 2000);
#else
HAL::delayMilliseconds(2000);
#endif
}
else {
//
// Show the MarlinKimbra logo with splash line 1
// After a delay show splash line 2, if it exists
//
#if ENABLED(STRING_SPLASH_LINE2)
#define _SPLASH_WAIT_1 1500
#else
#define _SPLASH_WAIT_1 2000
#endif
logo_lines(PSTR(""));
CENTER_OR_SCROLL(STRING_SPLASH_LINE1, _SPLASH_WAIT_1);
#if ENABLED(STRING_SPLASH_LINE2)
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 1500);
#endif
}
#elif ENABLED(STRING_SPLASH_LINE2)
//
// Show splash line 2 only, alongside the logo if possible
//
if (LCD_EXTRA_SPACE >= strlen(STRING_SPLASH_LINE2) + 1) {
logo_lines(PSTR(" " STRING_SPLASH_LINE2));
HAL::delayMilliseconds(2000);
}
else {
logo_lines(PSTR(""));
CENTER_OR_SCROLL(STRING_SPLASH_LINE2, 2000);
}
#else
//
// Show only the MarlinKimbra logo
//
logo_lines(PSTR(""));
HAL::delayMilliseconds(2000);
#endif
#ifdef FIRMWARE_URL
lcd_erase_line(3);
lcd_scroll(0, 3, PSTR(FIRMWARE_URL), LCD_WIDTH, 5000);
#endif
}
#endif // SHOW_BOOTSCREEN
FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink) {
......@@ -590,7 +625,7 @@ FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink)
}
}
/*
/**
Possible status screens:
16x2 |000/000 B000/000|
|0123456789012345|
......@@ -793,8 +828,8 @@ static void lcd_implementation_status_screen() {
if (card.isFileOpen()) {
// Draw the progress bar if the message has shown long enough
// or if there is no message set.
if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
if (ELAPSED(millis(), progress_bar_ms + PROGRESS_BAR_MSG_TIME) || !lcd_status_message[0]) {
int tix = (int)(card.percentDone() * (LCD_WIDTH) * 3) / 100,
cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
char msg[LCD_WIDTH + 1], b = ' ';
msg[i] = '\0';
......@@ -814,7 +849,7 @@ static void lcd_implementation_status_screen() {
//Display both Status message line and Filament display on the last line
#if HAS(LCD_FILAMENT_SENSOR) || HAS(LCD_POWER_SENSOR)
if (millis() >= previous_lcd_status_ms + 5000UL) {
if (ELAPSED(millis(), previous_lcd_status_ms + 5000UL)) {
lcd_print(lcd_status_message);
}
#if HAS(LCD_POWER_SENSOR)
......@@ -951,21 +986,25 @@ void lcd_implementation_drawedit(const char* pstr, const char* value = NULL) {
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
static void lcd_implementation_update_indicators() {
#if ENABLED(LCD_I2C_PANELOLU2) || ENABLED(LCD_I2C_VIKI)
// Set the LEDS - referred to as backlights by the LiquidTWI2 library
static uint8_t ledsprev = 0;
uint8_t leds = 0;
if (target_temperature_bed > 0) leds |= LED_A;
if (target_temperature[0] > 0) leds |= LED_B;
if (fanSpeed) leds |= LED_C;
#if HOTENDS > 1
if (target_temperature[1] > 0) leds |= LED_C;
#endif
if (leds != ledsprev) {
lcd.setBacklight(leds);
ledsprev = leds;
}
// Set the LEDS - referred to as backlights by the LiquidTWI2 library
static uint8_t ledsprev = 0;
uint8_t leds = 0;
if (target_temperature_bed > 0) leds |= LED_A;
if (target_temperature[0] > 0) leds |= LED_B;
if (fanSpeed) leds |= LED_C;
#if HOTENDS > 1
if (target_temperature[1] > 0) leds |= LED_C;
#endif
if (leds != ledsprev) {
lcd.setBacklight(leds);
ledsprev = leds;
}
}
#endif // LCD_HAS_STATUS_INDICATORS
......@@ -976,16 +1015,15 @@ void lcd_implementation_drawedit(const char* pstr, const char* value = NULL) {
static uint8_t lcd_implementation_read_slow_buttons() {
#if ENABLED(LCD_I2C_TYPE_MCP23017)
uint8_t slow_buttons;
// Reading these buttons this is likely to be too slow to call inside interrupt context
// so they are called during normal lcd_update
slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET;
uint8_t slow_bits = lcd.readButtons() << B_I2C_BTN_OFFSET;
#if ENABLED(LCD_I2C_VIKI)
if ((slow_buttons & (B_MI | B_RI)) && millis() < next_button_update_ms) // LCD clicked
slow_buttons &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated
#endif
return slow_buttons;
#endif
if ((slow_bits & (B_MI | B_RI)) && PENDING(millis(), next_button_update_ms)) // LCD clicked
slow_bits &= ~(B_MI | B_RI); // Disable LCD clicked buttons if screen is updated
#endif // LCD_I2C_VIKI
return slow_bits;
#endif // LCD_I2C_TYPE_MCP23017
}
#endif // LCD_HAS_SLOW_BUTTONS
......
......@@ -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)
......
......@@ -12,11 +12,11 @@
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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 @@
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