Changed the naming of some LCD functions, so the names match better what the function does. Also moved around some prototypes for general cleanup.

2.0.x
daid303 12 years ago
parent 94ea26ff46
commit 6a9bee27cc

@ -1,24 +1,22 @@
#ifndef CONFIG_STORE_H #ifndef CONFIG_STORE_H
#define CONFIG_STORE_H #define CONFIG_STORE_H
#include "Configuration.h" #include "Configuration.h"
void Config_ResetDefault(); void Config_ResetDefault();
#ifdef EEPROM_CHITCHAT #ifdef EEPROM_CHITCHAT
void Config_PrintSettings(); void Config_PrintSettings();
#else #else
FORCE_INLINE void Config_PrintSettings() {} FORCE_INLINE void Config_PrintSettings() {}
#endif #endif
#ifdef EEPROM_SETTINGS #ifdef EEPROM_SETTINGS
void Config_StoreSettings(); void Config_StoreSettings();
void Config_RetrieveSettings(); void Config_RetrieveSettings();
#else #else
FORCE_INLINE void Config_StoreSettings() {} FORCE_INLINE void Config_StoreSettings() {}
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); } FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
#endif
#endif #endif
#endif//CONFIG_STORE_H

@ -179,7 +179,8 @@ void setPwmFrequency(uint8_t pin, int val);
extern float homing_feedrate[]; extern float homing_feedrate[];
extern bool axis_relative_modes[]; extern bool axis_relative_modes[];
extern int feedmultiply; extern int feedmultiply;
extern bool feedmultiplychanged;
extern int extrudemultiply; // Sets extrude multiply factor (in percent) extern int extrudemultiply; // Sets extrude multiply factor (in percent)
extern float current_position[NUM_AXIS] ; extern float current_position[NUM_AXIS] ;
extern float add_homeing[3]; extern float add_homeing[3];

@ -146,7 +146,8 @@ CardReader card;
#endif #endif
float homing_feedrate[] = HOMING_FEEDRATE; float homing_feedrate[] = HOMING_FEEDRATE;
bool axis_relative_modes[] = AXIS_RELATIVE_MODES; bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int feedmultiply=100; //100->1 200->2 int feedmultiply=100; //100->1 200->2
bool feedmultiplychanged;
int saved_feedmultiply; int saved_feedmultiply;
int extrudemultiply=100; //100->1 200->2 int extrudemultiply=100; //100->1 200->2
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 }; float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
@ -360,7 +361,7 @@ void setup()
st_init(); // Initialize stepper, this enables interrupts! st_init(); // Initialize stepper, this enables interrupts!
setup_photpin(); setup_photpin();
LCD_INIT; lcd_init();
} }
@ -401,7 +402,7 @@ void loop()
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
checkHitEndstops(); checkHitEndstops();
LCD_STATUS; lcd_update();
} }
void get_command() void get_command()
@ -534,7 +535,7 @@ void get_command()
sprintf_P(time, PSTR("%i min, %i sec"),min,sec); sprintf_P(time, PSTR("%i min, %i sec"),min,sec);
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLN(time); SERIAL_ECHOLN(time);
LCD_MESSAGE(time); lcd_setstatus(time);
card.printingHasFinished(); card.printingHasFinished();
card.checkautostart(true); card.checkautostart(true);
@ -683,7 +684,7 @@ void process_commands()
while(millis() < codenum ){ while(millis() < codenum ){
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
break; break;
#ifdef FWRETRACT #ifdef FWRETRACT
@ -847,16 +848,16 @@ void process_commands()
previous_millis_cmd = millis(); previous_millis_cmd = millis();
if (codenum > 0){ if (codenum > 0){
codenum += millis(); // keep track of when we started waiting codenum += millis(); // keep track of when we started waiting
while(millis() < codenum && !CLICKED){ while(millis() < codenum && !LCD_CLICKED){
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
}else{ }else{
while(!CLICKED){ while(!LCD_CLICKED){
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
} }
} }
@ -947,7 +948,7 @@ void process_commands()
sprintf_P(time, PSTR("%i min, %i sec"), min, sec); sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLN(time); SERIAL_ECHOLN(time);
LCD_MESSAGE(time); lcd_setstatus(time);
autotempShutdown(); autotempShutdown();
} }
break; break;
@ -1075,7 +1076,7 @@ void process_commands()
} }
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
#ifdef TEMP_RESIDENCY_TIME #ifdef TEMP_RESIDENCY_TIME
/* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time /* start/restart the TEMP_RESIDENCY_TIME timer whenever we reach target temp for the first time
or when current temp falls outside the hysteresis after target temp was reached */ or when current temp falls outside the hysteresis after target temp was reached */
@ -1113,7 +1114,7 @@ void process_commands()
} }
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
LCD_MESSAGEPGM(MSG_BED_DONE); LCD_MESSAGEPGM(MSG_BED_DONE);
previous_millis_cmd = millis(); previous_millis_cmd = millis();
@ -1220,7 +1221,7 @@ void process_commands()
SERIAL_PROTOCOLPGM(MSG_M115_REPORT); SERIAL_PROTOCOLPGM(MSG_M115_REPORT);
break; break;
case 117: // M117 display message case 117: // M117 display message
LCD_MESSAGE(cmdbuffer[bufindr]+5); lcd_setstatus(cmdbuffer[bufindr]+5);
break; break;
case 114: // M114 case 114: // M114
SERIAL_PROTOCOLPGM("X:"); SERIAL_PROTOCOLPGM("X:");
@ -1370,7 +1371,8 @@ void process_commands()
{ {
if(code_seen('S')) if(code_seen('S'))
{ {
feedmultiply = code_value() ; feedmultiply = code_value() ;
feedmultiplychanged = true;
} }
} }
break; break;

@ -279,7 +279,7 @@ void CardReader::openFile(char* name,bool read)
sdpos = 0; sdpos = 0;
SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED); SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
LCD_MESSAGE(fname); lcd_setstatus(fname);
} }
else else
{ {
@ -301,7 +301,7 @@ void CardReader::openFile(char* name,bool read)
saving = true; saving = true;
SERIAL_PROTOCOLPGM(MSG_SD_WRITE_TO_FILE); SERIAL_PROTOCOLPGM(MSG_SD_WRITE_TO_FILE);
SERIAL_PROTOCOLLN(name); SERIAL_PROTOCOLLN(name);
LCD_MESSAGE(fname); lcd_setstatus(fname);
} }
} }

@ -69,6 +69,17 @@ private:
extern CardReader card; extern CardReader card;
#define IS_SD_PRINTING (card.sdprinting) #define IS_SD_PRINTING (card.sdprinting)
#if (SDCARDDETECT > -1)
# ifdef SDCARDDETECTINVERTED
# define IS_SD_INSERTED (READ(SDCARDDETECT)!=0)
# else
# define IS_SD_INSERTED (READ(SDCARDDETECT)==0)
# endif //SDCARDTETECTINVERTED
#else
//If we don't have a card detect line, aways asume the card is inserted
# define IS_SD_INSERTED true
#endif
#else #else
#define IS_SD_PRINTING (false) #define IS_SD_PRINTING (false)

@ -506,7 +506,7 @@ void plan_buffer_line(const float &x, const float &y, const float &z, const floa
{ {
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
// The target position of the tool in absolute steps // The target position of the tool in absolute steps

@ -905,7 +905,7 @@ void st_synchronize()
while( blocks_queued()) { while( blocks_queued()) {
manage_heater(); manage_heater();
manage_inactivity(); manage_inactivity();
LCD_STATUS; lcd_update();
} }
} }

@ -190,6 +190,9 @@ void PID_autotune(float temp, int extruder, int ncycles)
for(;;) { for(;;) {
if(temp_meas_ready == true) { // temp sample ready if(temp_meas_ready == true) { // temp sample ready
//Reset the watchdog after we know we have a temperature measurement.
watchdog_reset();
CRITICAL_SECTION_START; CRITICAL_SECTION_START;
temp_meas_ready = false; temp_meas_ready = false;
CRITICAL_SECTION_END; CRITICAL_SECTION_END;
@ -291,7 +294,7 @@ void PID_autotune(float temp, int extruder, int ncycles)
SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h"); SERIAL_PROTOCOLLNPGM("PID Autotune finished ! Place the Kp, Ki and Kd constants in the configuration.h");
return; return;
} }
LCD_STATUS; lcd_update();
} }
} }
@ -957,9 +960,7 @@ ISR(TIMER0_COMPB_vect)
ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07)); ADMUX = ((1 << REFS0) | (TEMP_0_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion ADCSRA |= 1<<ADSC; // Start conversion
#endif #endif
#ifdef ULTIPANEL lcd_buttons_update();
buttons_check();
#endif
temp_state = 1; temp_state = 1;
break; break;
case 1: // Measure TEMP_0 case 1: // Measure TEMP_0
@ -981,9 +982,7 @@ ISR(TIMER0_COMPB_vect)
ADMUX = ((1 << REFS0) | (TEMP_BED_PIN & 0x07)); ADMUX = ((1 << REFS0) | (TEMP_BED_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion ADCSRA |= 1<<ADSC; // Start conversion
#endif #endif
#ifdef ULTIPANEL lcd_buttons_update();
buttons_check();
#endif
temp_state = 3; temp_state = 3;
break; break;
case 3: // Measure TEMP_BED case 3: // Measure TEMP_BED
@ -1002,9 +1001,7 @@ ISR(TIMER0_COMPB_vect)
ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07)); ADMUX = ((1 << REFS0) | (TEMP_1_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion ADCSRA |= 1<<ADSC; // Start conversion
#endif #endif
#ifdef ULTIPANEL lcd_buttons_update();
buttons_check();
#endif
temp_state = 5; temp_state = 5;
break; break;
case 5: // Measure TEMP_1 case 5: // Measure TEMP_1
@ -1023,9 +1020,7 @@ ISR(TIMER0_COMPB_vect)
ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07)); ADMUX = ((1 << REFS0) | (TEMP_2_PIN & 0x07));
ADCSRA |= 1<<ADSC; // Start conversion ADCSRA |= 1<<ADSC; // Start conversion
#endif #endif
#ifdef ULTIPANEL lcd_buttons_update();
buttons_check();
#endif
temp_state = 7; temp_state = 7;
break; break;
case 7: // Measure TEMP_2 case 7: // Measure TEMP_2

File diff suppressed because it is too large Load Diff

@ -4,38 +4,47 @@
#include "Marlin.h" #include "Marlin.h"
#ifdef ULTRA_LCD #ifdef ULTRA_LCD
#include "language.h"
#if LANGUAGE_CHOICE == 6
#include "LiquidCrystalRus.h"
#define LCD_CLASS LiquidCrystalRus
#else
#include <LiquidCrystal.h>
#define LCD_CLASS LiquidCrystal
#endif
#if LANGUAGE_CHOICE == 6 void lcd_update();
#include "LiquidCrystalRus.h" void lcd_init();
#define LCD_CLASS LiquidCrystalRus void lcd_setstatus(const char* message);
#else void lcd_setstatuspgm(const char* message);
#include <LiquidCrystal.h> void lcd_setalertstatuspgm(const char* message);
#define LCD_CLASS LiquidCrystal void lcd_buttons_update();
#endif void lcd_buttons_init();
void lcd_status(); #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
void lcd_init(); #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
void lcd_status(const char* message);
void beep();
void buttons_init();
void buttons_check();
#define LCD_UPDATE_INTERVAL 100 #define LCD_UPDATE_INTERVAL 100
#define STATUSTIMEOUT 15000 #define LCD_TIMEOUT_TO_STATUS 15000
extern LCD_CLASS lcd; extern volatile uint8_t buttons; //the last checked buttons in a bit array.
extern volatile char buttons; //the last checked buttons in a bit array. extern int plaPreheatHotendTemp;
extern int plaPreheatHPBTemp;
#ifdef NEWPANEL extern int plaPreheatFanSpeed;
extern int absPreheatHotendTemp;
extern int absPreheatHPBTemp;
extern int absPreheatFanSpeed;
#ifdef NEWPANEL
#define EN_C (1<<BLEN_C) #define EN_C (1<<BLEN_C)
#define EN_B (1<<BLEN_B) #define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A) #define EN_A (1<<BLEN_A)
#define CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#define BLOCK {blocking=millis()+blocktime;} #define LCD_BLOCK {blocking=millis()+blocktime;}
#else #else
//atomatic, do not change //atomatic, do not change
#define B_LE (1<<BL_LE) #define B_LE (1<<BL_LE)
#define B_UP (1<<BL_UP) #define B_UP (1<<BL_UP)
@ -46,28 +55,18 @@ extern volatile char buttons; //the last checked buttons in a bit array.
#define EN_B (1<<BLEN_B) #define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A) #define EN_A (1<<BLEN_A)
#define CLICKED ((buttons&B_MI)||(buttons&B_ST)) #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
#define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;} #define LCD_BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
#endif #endif
#if (SDCARDDETECT > -1)
#ifdef SDCARDDETECTINVERTED
#define CARDINSERTED (READ(SDCARDDETECT)!=0)
#else
#define CARDINSERTED (READ(SDCARDDETECT)==0)
#endif //SDCARDTETECTINVERTED
#else
//If we don't have a card detect line, aways asume the card is inserted
#define CARDINSERTED true
#endif
// blocking time for recognizing a new keypress of one key, ms // blocking time for recognizing a new keypress of one key, ms
#define blocktime 500 #define blocktime 500
#define lcdslow 5 #define lcdslow 5
enum MainStatus{Main_Status, Main_Menu, Main_Prepare,Sub_PrepareMove, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl,Sub_RetractControl, Sub_PreheatPLASettings, Sub_PreheatABSSettings}; enum MainStatus{Main_Status, Main_Menu, Main_Prepare,Sub_PrepareMove, Main_Control, Main_SD,Sub_TempControl,Sub_MotionControl,Sub_RetractControl, Sub_PreheatPLASettings, Sub_PreheatABSSettings};
extern LCD_CLASS lcd;
class MainMenu{ class MainMenu{
public: public:
MainMenu(); MainMenu();
@ -146,50 +145,29 @@ extern volatile char buttons; //the last checked buttons in a bit array.
} }
} }
}; };
//conversion routines, could need some overworking
char *ftostr51(const float &x);
char *ftostr52(const float &x);
char *ftostr31(const float &x);
char *ftostr3(const float &x);
#define LCD_INIT lcd_init();
#define LCD_MESSAGE(x) lcd_status(x);
#define LCD_MESSAGEPGM(x) lcd_statuspgm(PSTR(x));
#define LCD_ALERTMESSAGEPGM(x) lcd_alertstatuspgm(PSTR(x));
#define LCD_STATUS lcd_status()
#else //no lcd #else //no lcd
#define LCD_INIT FORCE_INLINE void lcd_update() {}
#define LCD_STATUS FORCE_INLINE void lcd_init() {}
#define LCD_MESSAGE(x) FORCE_INLINE void lcd_setstatus(const char* message) {}
#define LCD_MESSAGEPGM(x) FORCE_INLINE void lcd_buttons_init() {}
#define LCD_ALERTMESSAGEPGM(x) FORCE_INLINE void lcd_buttons_update() {}
FORCE_INLINE void lcd_status() {};
#define LCD_MESSAGEPGM(x)
#define LCD_ALERTMESSAGEPGM(x)
#define CLICKED false #define CLICKED false
#define BLOCK ; #define BLOCK ;
#endif #endif
void lcd_statuspgm(const char* message);
void lcd_alertstatuspgm(const char* message);
char *ftostr3(const float &x);
char *itostr2(const uint8_t &x); char *itostr2(const uint8_t &x);
char *ftostr31(const float &x);
char *ftostr32(const float &x);
char *itostr31(const int &xx); char *itostr31(const int &xx);
char *itostr3(const int &xx); char *itostr3(const int &xx);
char *itostr4(const int &xx); char *itostr4(const int &xx);
char *ftostr3(const float &x);
char *ftostr31(const float &x);
char *ftostr32(const float &x);
char *ftostr51(const float &x); char *ftostr51(const float &x);
char *ftostr52(const float &x);
//TODO: These do not belong here.
extern int plaPreheatHotendTemp;
extern int plaPreheatHPBTemp;
extern int plaPreheatFanSpeed;
extern int absPreheatHotendTemp;
extern int absPreheatHPBTemp;
extern int absPreheatFanSpeed;
#endif //ULTRALCD #endif //ULTRALCD

Loading…
Cancel
Save