Commit d4504571 authored by MagoKimbra's avatar MagoKimbra

Update and fix

parent 49ff3bfa
......@@ -44,8 +44,8 @@
//#define FIRMWARE_TEST // ONLY BAUDRATE 115200
// Some particular clients re-start sending commands only after receiving a 'wait' when there is a bed serial-connection.
//#define NO_TIMEOUTS 1000 // Milliseconds
//#define ADVANCED_OK // Uncomment to include more info in ok command
#define NO_TIMEOUTS 1000 // Milliseconds
//#define ADVANCED_OK // Uncomment to include more info in ok command
/***********************************************************************/
......
......@@ -350,8 +350,8 @@
* (i.e. the software might assume it can be done instantaneously) *
* *
*****************************************************************************************/
#define DEFAULT_XYJERK 10.0 // (mm/sec)
#define DEFAULT_ZJERK 0.4 // (mm/sec)
#define DEFAULT_XYJERK 20.0 // (mm/sec)
#define DEFAULT_ZJERK 20.0 // (mm/sec)
// max initial speed for retract moves E0... (mm/sec) per extruder
#define DEFAULT_EJERK {5.0, 5.0, 5.0, 5.0}
/*****************************************************************************************/
......
......@@ -93,7 +93,6 @@
* *
*****************************************************************************************/
#define AUTOTEMP
#define AUTOTEMP_OLDWEIGHT 0.98
/*****************************************************************************************/
......@@ -983,6 +982,8 @@
//#define SDEXTRASLOW // Use even slower SD transfer mode (not normally needed - uncomment if you're getting volume init error)
//#define SD_CHECK_AND_RETRY // Use CRC checks and retries on the SD communication
// Decomment thi if you are external SD without DETECT_PIN
//#define SD_DISABLED_DETECT
// Some RAMPS and other boards don't detect when an SD card is inserted. You can work
// around this by connecting a push button or single throw switch to the pin defined
// as SD_DETECT_PIN in your board's pins definitions.
......@@ -1480,4 +1481,4 @@
//#define WATCHDOG_RESET_MANUAL
/*****************************************************************************************/
#endif
\ No newline at end of file
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#ifndef MACROS_H
#define MACROS_H
// Compiler warning on unused varable.
#define UNUSED(x) (void) (x)
// Macros for bit masks
#define BIT(b) (1<<(b))
#define TEST(n,b) (((n)&BIT(b))!=0)
......
......@@ -32,6 +32,7 @@
NexPage Pmenu = NexPage(3, 0, "menu");
NexPage Psdcard = NexPage(4, 0, "sdcard");
NexPage Psetup = NexPage(5, 0, "setup");
NexPage Pmove = NexPage(6, 0, "move");
// Text
NexText Hotend0 = NexText(1, 1, "t0");
......@@ -41,7 +42,6 @@
NexText LedStatus = NexText(1, 7, "t4");
NexText LedCoord = NexText(1, 8, "t5");
NexText set0 = NexText(2, 2, "set0");
NexText set1 = NexText(2, 15, "set1");
NexText sdrow0 = NexText(4, 3, "t0");
NexText sdrow1 = NexText(4, 4, "t1");
NexText sdrow2 = NexText(4, 5, "t2");
......@@ -58,6 +58,9 @@
NexPicture Hend1 = NexPicture(1, 14, "p4");
NexPicture Hend2 = NexPicture(1, 15, "p5");
NexPicture Fanpic = NexPicture(1, 19, "p6");
NexPicture NPlay = NexPicture(1, 27, "p7");
NexPicture NStop = NexPicture(1, 28, "p8");
NexPicture Exit1 = NexPicture(3, 4, "p3");
NexPicture Folder0 = NexPicture(4, 9, "p0");
NexPicture Folder1 = NexPicture(4, 10, "p1");
NexPicture Folder2 = NexPicture(4, 11, "p2");
......@@ -65,7 +68,16 @@
NexPicture Folder4 = NexPicture(4, 13, "p4");
NexPicture Folder5 = NexPicture(4, 14, "p5");
NexPicture Folderup = NexPicture(4, 15, "p6");
NexPicture Exit = NexPicture(4, 16, "p7");
NexPicture Exit2 = NexPicture(4, 16, "p7");
NexPicture Exit3 = NexPicture(5, 4, "p3");
NexPicture XYHome = NexPicture(6, 5, "p4");
NexPicture XYUp = NexPicture(6, 6, "p5");
NexPicture XYRight = NexPicture(6, 7, "p6");
NexPicture XYDown = NexPicture(6, 8, "p7");
NexPicture XYLeft = NexPicture(6, 9, "p8");
NexPicture ZHome = NexPicture(6, 10, "p9");
NexPicture ZUp = NexPicture(6, 11, "p10");
NexPicture ZDown = NexPicture(6, 12, "p11");
// Progress Bar
NexProgressBar sdbar = NexProgressBar(1, 26, "j0");
......@@ -92,6 +104,7 @@
// Variable
NexVar Hotend = NexVar(1, 20, "he");
NexVar set1 = NexVar(2, 17, "set1");
NexVar Bed = NexVar(1, 21, "bed");
NexVar filename0 = NexVar(4, 19, "va0");
NexVar filename1 = NexVar(4, 20, "va1");
......@@ -99,6 +112,7 @@
NexVar filename3 = NexVar(4, 22, "va3");
NexVar filename4 = NexVar(4, 23, "va4");
NexVar filename5 = NexVar(4, 24, "va5");
NexVar movecmd = NexVar(6, 18, "vacmd");
NexTouch *nex_listen_list[] =
{
......@@ -107,6 +121,8 @@
&MSD,
&MSetup,
&Fanpic,
&NPlay,
&NStop,
&hot0,
&hot1,
&hot2,
......@@ -121,7 +137,17 @@
&sdrow4,
&sdrow5,
&Folderup,
&Exit,
&Exit1,
&Exit2,
&Exit3,
&XYHome,
&XYUp,
&XYRight,
&XYDown,
&XYLeft,
&ZHome,
&ZUp,
&ZDown,
NULL
};
......@@ -266,21 +292,21 @@
}
void sdlistPopCallback(void *ptr) {
uint32_t number = 0;
sdlist.getValue(&number);
number = slidermaxval - number;
setrowsdcard(number);
uint32_t number = 0;
sdlist.getValue(&number);
number = slidermaxval - number;
setrowsdcard(number);
}
static void menu_action_sdfile(const char* filename) {
char cmd[30];
char* c;
sprintf_P(cmd, PSTR("M23 %s"), filename);
for(c = &cmd[4]; *c; c++) *c = tolower(*c);
enqueuecommand(cmd);
enqueuecommands_P(PSTR("M24"));
setpageInfo();
}
char cmd[30];
char* c;
sprintf_P(cmd, PSTR("M23 %s"), filename);
for(c = &cmd[4]; *c; c++) *c = tolower(*c);
enqueuecommand(cmd);
enqueuecommands_P(PSTR("M24"));
setpageInfo();
}
static void menu_action_sddirectory(const char* filename) {
card.chdir(filename);
......@@ -330,13 +356,14 @@
setpagesdcard();
}
void ExitPopCallback(void *ptr) {
setpageInfo();
}
#endif
void ExitPopCallback(void *ptr) {
setpageInfo();
}
void PstartPopCallback(void *ptr) {
setpageInfo();
setpageInfo();
}
void hotPopCallback(void *ptr) {
......@@ -400,13 +427,17 @@
}
void setpagePopCallback(void *ptr) {
if (ptr == &Menu)
if (ptr == &Menu) {
PageInfo = false;
Pmenu.show();
if (ptr == &MSetup)
}
else if (ptr == &MSetup) {
PageInfo = false;
Psetup.show();
}
#if ENABLED(SDSUPPORT)
if (ptr == &MSD)
else if (ptr == &MSD)
setpagesdcard();
#endif
}
......@@ -416,6 +447,31 @@
else fanSpeed = 255;
}
void setmovePopCallback(void *ptr) {
memset(buffer, 0, sizeof(buffer));
movecmd.getText(buffer, sizeof(buffer));
enqueuecommands_P(PSTR("G91"));
enqueuecommands_P(buffer);
enqueuecommands_P(PSTR("G90"));
}
void PlayPausePopCallback(void *ptr) {
if (card.cardOK && card.isFileOpen()) {
if (card.sdprinting)
card.pauseSDPrint();
else
card.startFileprint();
}
}
void StopPopCallback(void *ptr) {
quickStop();
card.sdprinting = false;
card.closeFile();
autotempShutdown();
lcd_setstatus(MSG_PRINT_ABORTED, true);
}
void lcd_init() {
delay(1000);
NextionON = nexInit();
......@@ -425,12 +481,16 @@
} else {
ECHO_LM(DB, "Nextion LCD connected!");
Pstart.attachPop(PstartPopCallback);
Pstart.attachPop(ExitPopCallback);
Exit1.attachPop(ExitPopCallback);
Exit3.attachPop(ExitPopCallback);
#if ENABLED(SDSUPPORT)
MSD.attachPop(setpagePopCallback, &MSD);
sdlist.attachPop(sdlistPopCallback);
Exit.attachPop(ExitPopCallback);
Exit2.attachPop(ExitPopCallback);
NPlay.attachPop(PlayPausePopCallback);
NStop.attachPop(StopPopCallback);
#endif
#if HAS_TEMP_0
......@@ -444,11 +504,19 @@
#endif
Menu.attachPop(setpagePopCallback, &Menu);
MSetup.attachPop(setpagePopCallback, &Menu);
MSetup.attachPop(setpagePopCallback, &MSetup);
Fanpic.attachPop(setfanPopCallback, &Fanpic);
m11.attachPop(sethotPopCallback, &m11);
tup.attachPop(settempPopCallback, &tup);
tdown.attachPop(settempPopCallback, &tdown);
XYHome.attachPop(setmovePopCallback);
XYUp.attachPop(setmovePopCallback);
XYRight.attachPop(setmovePopCallback);
XYDown.attachPop(setmovePopCallback);
XYLeft.attachPop(setmovePopCallback);
ZHome.attachPop(setmovePopCallback);
ZUp.attachPop(setmovePopCallback);
ZDown.attachPop(setmovePopCallback);
startimer.enable();
}
......@@ -479,7 +547,7 @@
}
static void coordtoLCD() {
char *valuetemp;
char* valuetemp;
memset(buffer, 0, sizeof(buffer));
strcat(buffer, "X");
......@@ -545,13 +613,29 @@
coordtoLCD();
#if ENABLED(SDSUPPORT)
if (card.cardOK)
if (card.cardOK) {
MSD.setPic(7);
else
NPlay.setPic(38);
NStop.setPic(41);
}
else {
MSD.setPic(6);
if (IS_SD_PRINTING)
// Progress bar solid part
sdbar.setValue(card.percentDone());
NPlay.setPic(39);
NStop.setPic(42);
}
if (card.isFileOpen()) {
if (card.sdprinting) {
// Progress bar solid part
sdbar.setValue(card.percentDone());
NPlay.setPic(38);
}
else {
NPlay.setPic(40);
}
}
#endif
next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL;
......
......@@ -4,12 +4,13 @@
#if ENABLED(NEXTION)
#define LCD_UPDATE_INTERVAL 5000
void PstartPopCallback(void *ptr);
void ExitUpPopCallback(void *ptr);
void setpagePopCallback(void *ptr);
void hotPopCallback(void *ptr);
void sethotPopCallback(void *ptr);
void settempPopCallback(void *ptr);
void setfanPopCallback(void *ptr);
void setmovePopCallback(void *ptr);
void lcd_update();
void lcd_init();
void lcd_setstatus(const char* message, const bool persist = false);
......@@ -22,7 +23,8 @@
void sdfilePopCallback(void *ptr);
void sdfolderPopCallback(void *ptr);
void sdfolderUpPopCallback(void *ptr);
void ExitUpPopCallback(void *ptr);
void PlayPausePopCallback(void *ptr);
void StopPopCallback(void *ptr);
#endif
FORCE_INLINE bool lcd_hasstatus() { return false; }
......
This diff is collapsed.
This diff is collapsed.
......@@ -19,17 +19,17 @@
*/
#ifndef TEMPERATURE_H
#define TEMPERATURE_H
#define TEMPERATURE_H
// public functions
void tp_init(); //initialize the heating
void manage_heater(); //it is critical that this is called periodically.
#if ENABLED(FILAMENT_SENSOR)
// For converting raw Filament Width to milimeters
float analog2widthFil();
// For converting raw Filament Width to milimeters
float analog2widthFil();
// For converting raw Filament Width to an extrusion ratio
// For converting raw Filament Width to an extrusion ratio
int widthFil_to_size_ratio();
#endif
......@@ -80,7 +80,7 @@ extern float current_temperature_bed;
#if ENABLED(BABYSTEPPING)
extern volatile int babystepsTodo[3];
#endif
//high level conversion routines, for use outside of temperature.cpp
//inline so that there is no performance decrease.
//deg=degreeCelsius
......@@ -102,16 +102,16 @@ FORCE_INLINE float degTargetHotend(uint8_t hotend) { return target_temperature[H
FORCE_INLINE float degTargetBed() { return target_temperature_bed; }
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
void start_watching_heater(int e=0);
void start_watching_heater(int h = 0);
#endif
FORCE_INLINE void setTargetHotend(const float &celsius, uint8_t hotend) {
FORCE_INLINE void setTargetHotend(const float& celsius, uint8_t hotend) {
target_temperature[HOTEND_ARG] = celsius;
#if ENABLED(THERMAL_PROTECTION_HOTENDS)
start_watching_heater(HOTEND_ARG);
#endif
}
FORCE_INLINE void setTargetBed(const float &celsius) { target_temperature_bed = celsius; }
FORCE_INLINE void setTargetBed(const float& celsius) { target_temperature_bed = celsius; }
FORCE_INLINE bool isHeatingHotend(uint8_t hotend) { return target_temperature[HOTEND_ARG] > current_temperature[HOTEND_ARG]; }
FORCE_INLINE bool isHeatingBed() { return target_temperature_bed > current_temperature_bed; }
......
......@@ -339,10 +339,14 @@ static void lcd_status_screen() {
lcd_status_message[0] = '\0';
expire_status_ms = 0;
}
} else
}
else {
expire_status_ms += LCD_UPDATE_INTERVAL;
} else
}
}
else {
expire_status_ms = 0;
}
#else
expire_status_ms = 0;
#endif // SDSUPPORT
......@@ -377,7 +381,8 @@ static void lcd_status_screen() {
ignore_click = wait_for_unclick = false;
else
current_click = false;
} else if (current_click) {
}
else if (current_click) {
lcd_quick_feedback();
wait_for_unclick = true;
current_click = false;
......@@ -399,7 +404,7 @@ static void lcd_status_screen() {
#if ENABLED(ULTIPANEL_FEEDMULTIPLY)
// Dead zone at 100% feedrate
if ((feedrate_multiplier < 100 && (feedrate_multiplier + int(encoderPosition)) > 100) ||
(feedrate_multiplier > 100 && (feedrate_multiplier + int(encoderPosition)) < 100)) {
(feedrate_multiplier > 100 && (feedrate_multiplier + int(encoderPosition)) < 100)) {
encoderPosition = 0;
feedrate_multiplier = 100;
}
......@@ -472,13 +477,15 @@ static void lcd_main_menu() {
else
MENU_ITEM(function, MSG_RESUME_PRINT, lcd_sdcard_resume);
MENU_ITEM(function, MSG_STOP_PRINT, lcd_sdcard_stop);
} else {
}
else {
MENU_ITEM(submenu, MSG_CARD_MENU, lcd_sdcard_menu);
#if !PIN_EXISTS(SD_DETECT)
MENU_ITEM(gcode, MSG_CNG_SDCARD, PSTR("M21")); // SD-card changed by user
#endif
}
} else {
}
else {
MENU_ITEM(submenu, MSG_NO_CARD, lcd_sdcard_menu);
#if !PIN_EXISTS(SD_DETECT)
MENU_ITEM(gcode, MSG_INIT_SDCARD, PSTR("M21")); // Manually initialize the SD-card via user interface
......@@ -509,7 +516,7 @@ void lcd_set_home_offsets() {
#if ENABLED(BABYSTEPPING)
static void _lcd_babystep(menuFunc_t menu, int axis, const char *msg) {
static void _lcd_babystep(menuFunc_t menu, int axis, const char* msg) {
if (encoderPosition != 0) {
babystepsTodo[axis] += (int)encoderPosition;
encoderPosition = 0;
......@@ -1644,31 +1651,31 @@ void lcd_init() {
SET_INPUT(BTN_EN2);
WRITE(BTN_EN1,HIGH);
WRITE(BTN_EN2,HIGH);
#if BTN_ENC > 0
SET_INPUT(BTN_ENC);
WRITE(BTN_ENC,HIGH);
#endif
#if ENABLED(REPRAPWORLD_KEYPAD)
pinMode(SHIFT_CLK,OUTPUT);
pinMode(SHIFT_LD,OUTPUT);
pinMode(SHIFT_OUT,INPUT);
WRITE(SHIFT_OUT,HIGH);
WRITE(SHIFT_LD,HIGH);
#endif
#else // Not NEWPANEL
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
pinMode (SR_DATA_PIN, OUTPUT);
pinMode (SR_CLK_PIN, OUTPUT);
#elif ENABLED(SHIFT_CLK)
pinMode(SHIFT_CLK,OUTPUT);
pinMode(SHIFT_LD,OUTPUT);
pinMode(SHIFT_EN,OUTPUT);
pinMode(SHIFT_OUT,INPUT);
WRITE(SHIFT_OUT,HIGH);
WRITE(SHIFT_LD,HIGH);
WRITE(SHIFT_EN,LOW);
#endif // SR_LCD_2W_NL
#endif//!NEWPANEL
#if BTN_ENC > 0
SET_INPUT(BTN_ENC);
WRITE(BTN_ENC,HIGH);
#endif
#if ENABLED(REPRAPWORLD_KEYPAD)
pinMode(SHIFT_CLK,OUTPUT);
pinMode(SHIFT_LD,OUTPUT);
pinMode(SHIFT_OUT,INPUT);
WRITE(SHIFT_OUT,HIGH);
WRITE(SHIFT_LD,HIGH);
#endif
#else // Not NEWPANEL
#if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
pinMode (SR_DATA_PIN, OUTPUT);
pinMode (SR_CLK_PIN, OUTPUT);
#elif ENABLED(SHIFT_CLK)
pinMode(SHIFT_CLK,OUTPUT);
pinMode(SHIFT_LD,OUTPUT);
pinMode(SHIFT_EN,OUTPUT);
pinMode(SHIFT_OUT,INPUT);
WRITE(SHIFT_OUT,HIGH);
WRITE(SHIFT_LD,HIGH);
WRITE(SHIFT_EN,LOW);
#endif // SR_LCD_2W_NL
#endif//!NEWPANEL
#if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT)
pinMode(SD_DETECT_PIN, INPUT);
......
#include "base.h"
#if ENABLED(USE_WATCHDOG)
#include <avr/wdt.h>
#include "whatchdog.h"
//===========================================================================
//============================ private variables ============================
//===========================================================================
//===========================================================================
//================================ functions ================================
//===========================================================================
#include "watchdog.h"
/// intialise watch dog with a 4 sec interrupt time
void watchdog_init()
{
// Initialize watchdog with a 4 sec interrupt time
void watchdog_init() {
#if ENABLED(WATCHDOG_RESET_MANUAL)
//We enable the watchdog timer, but only for the interrupt.
//Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
// We enable the watchdog timer, but only for the interrupt.
// Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
wdt_reset();
_WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
_WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
......@@ -27,23 +17,18 @@ void watchdog_init()
#endif
}
/// reset watchdog. MUST be called every 1s after init or avr will reset.
void watchdog_reset()
{
wdt_reset();
}
//===========================================================================
//=================================== ISR ===================================
//===========================================================================
// Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled.
#if ENABLED(WATCHDOG_RESET_MANUAL)
ISR(WDT_vect) {
ECHO_LM(ER, MSG_WATCHDOG_RESET);
kill(PSTR("ERR:Please Reset")); // kill blocks //16 characters so it fits on a 16x2 display
while(1); // wait for user or serial reset
}
#endif // RESET_MANUAL
#endif // USE_WATCHDOG
ISR(WDT_vect) {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM("Something is wrong, please turn off the printer.");
kill(PSTR("ERR:Please Reset")); //kill blocks //16 characters so it fits on a 16x2 display
while (1); //wait for user or serial reset
}
#endif //WATCHDOG_RESET_MANUAL
#endif //USE_WATCHDOG
#ifndef WATCHDOG_H
#define WATCHDOG_H
// initialize watch dog with a 1 sec interrupt time
#include "Marlin_main.h"
#include <avr/wdt.h>
// Initialize watchdog with a 4 second interrupt time
void watchdog_init();
// pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures..
void watchdog_reset();
// Reset watchdog. MUST be called at least every 4 seconds after the
// first watchdog_init or AVR will go into emergency procedures.
inline void watchdog_reset() { wdt_reset(); }
#endif
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