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

This commit is contained in:
daid303 2012-12-03 12:52:00 +01:00
parent 94ea26ff46
commit 6a9bee27cc
10 changed files with 275 additions and 296 deletions

View file

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

View file

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

View file

@ -146,7 +146,8 @@ CardReader card;
#endif
float homing_feedrate[] = HOMING_FEEDRATE;
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 extrudemultiply=100; //100->1 200->2
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!
setup_photpin();
LCD_INIT;
lcd_init();
}
@ -401,7 +402,7 @@ void loop()
manage_heater();
manage_inactivity();
checkHitEndstops();
LCD_STATUS;
lcd_update();
}
void get_command()
@ -534,7 +535,7 @@ void get_command()
sprintf_P(time, PSTR("%i min, %i sec"),min,sec);
SERIAL_ECHO_START;
SERIAL_ECHOLN(time);
LCD_MESSAGE(time);
lcd_setstatus(time);
card.printingHasFinished();
card.checkautostart(true);
@ -683,7 +684,7 @@ void process_commands()
while(millis() < codenum ){
manage_heater();
manage_inactivity();
LCD_STATUS;
lcd_update();
}
break;
#ifdef FWRETRACT
@ -847,16 +848,16 @@ void process_commands()
previous_millis_cmd = millis();
if (codenum > 0){
codenum += millis(); // keep track of when we started waiting
while(millis() < codenum && !CLICKED){
while(millis() < codenum && !LCD_CLICKED){
manage_heater();
manage_inactivity();
LCD_STATUS;
lcd_update();
}
}else{
while(!CLICKED){
while(!LCD_CLICKED){
manage_heater();
manage_inactivity();
LCD_STATUS;
lcd_update();
}
}
}
@ -947,7 +948,7 @@ void process_commands()
sprintf_P(time, PSTR("%i min, %i sec"), min, sec);
SERIAL_ECHO_START;
SERIAL_ECHOLN(time);
LCD_MESSAGE(time);
lcd_setstatus(time);
autotempShutdown();
}
break;
@ -1075,7 +1076,7 @@ void process_commands()
}
manage_heater();
manage_inactivity();
LCD_STATUS;
lcd_update();
#ifdef TEMP_RESIDENCY_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 */
@ -1113,7 +1114,7 @@ void process_commands()
}
manage_heater();
manage_inactivity();
LCD_STATUS;
lcd_update();
}
LCD_MESSAGEPGM(MSG_BED_DONE);
previous_millis_cmd = millis();
@ -1220,7 +1221,7 @@ void process_commands()
SERIAL_PROTOCOLPGM(MSG_M115_REPORT);
break;
case 117: // M117 display message
LCD_MESSAGE(cmdbuffer[bufindr]+5);
lcd_setstatus(cmdbuffer[bufindr]+5);
break;
case 114: // M114
SERIAL_PROTOCOLPGM("X:");
@ -1370,7 +1371,8 @@ void process_commands()
{
if(code_seen('S'))
{
feedmultiply = code_value() ;
feedmultiply = code_value() ;
feedmultiplychanged = true;
}
}
break;

View file

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

View file

@ -69,6 +69,17 @@ private:
extern CardReader card;
#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
#define IS_SD_PRINTING (false)

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

@ -4,38 +4,47 @@
#include "Marlin.h"
#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
#include "LiquidCrystalRus.h"
#define LCD_CLASS LiquidCrystalRus
#else
#include <LiquidCrystal.h>
#define LCD_CLASS LiquidCrystal
#endif
void lcd_update();
void lcd_init();
void lcd_setstatus(const char* message);
void lcd_setstatuspgm(const char* message);
void lcd_setalertstatuspgm(const char* message);
void lcd_buttons_update();
void lcd_buttons_init();
void lcd_status();
void lcd_init();
void lcd_status(const char* message);
void beep();
void buttons_init();
void buttons_check();
#define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
#define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
#define LCD_UPDATE_INTERVAL 100
#define STATUSTIMEOUT 15000
#define LCD_UPDATE_INTERVAL 100
#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.
#ifdef NEWPANEL
extern int plaPreheatHotendTemp;
extern int plaPreheatHPBTemp;
extern int plaPreheatFanSpeed;
extern int absPreheatHotendTemp;
extern int absPreheatHPBTemp;
extern int absPreheatFanSpeed;
#ifdef NEWPANEL
#define EN_C (1<<BLEN_C)
#define EN_B (1<<BLEN_B)
#define EN_A (1<<BLEN_A)
#define CLICKED (buttons&EN_C)
#define BLOCK {blocking=millis()+blocktime;}
#else
#define LCD_CLICKED (buttons&EN_C)
#define LCD_BLOCK {blocking=millis()+blocktime;}
#else
//atomatic, do not change
#define B_LE (1<<BL_LE)
#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_A (1<<BLEN_A)
#define CLICKED ((buttons&B_MI)||(buttons&B_ST))
#define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
#endif
#define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
#define LCD_BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
#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
#define blocktime 500
#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};
extern LCD_CLASS lcd;
class MainMenu{
public:
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
#define LCD_INIT
#define LCD_STATUS
#define LCD_MESSAGE(x)
#define LCD_MESSAGEPGM(x)
#define LCD_ALERTMESSAGEPGM(x)
FORCE_INLINE void lcd_status() {};
FORCE_INLINE void lcd_update() {}
FORCE_INLINE void lcd_init() {}
FORCE_INLINE void lcd_setstatus(const char* message) {}
FORCE_INLINE void lcd_buttons_init() {}
FORCE_INLINE void lcd_buttons_update() {}
#define LCD_MESSAGEPGM(x)
#define LCD_ALERTMESSAGEPGM(x)
#define CLICKED false
#define BLOCK ;
#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 *ftostr31(const float &x);
char *ftostr32(const float &x);
char *itostr31(const int &xx);
char *itostr3(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);
//TODO: These do not belong here.
extern int plaPreheatHotendTemp;
extern int plaPreheatHPBTemp;
extern int plaPreheatFanSpeed;
extern int absPreheatHotendTemp;
extern int absPreheatHPBTemp;
extern int absPreheatFanSpeed;
char *ftostr52(const float &x);
#endif //ULTRALCD