Commit da018b82 authored by Simone Primarosa's avatar Simone Primarosa

Merge pull request #65 from simonepri/master

Update 4.1.5 dev
parents 2ddf7334 9a3533ea
### Version 4.1.5 ### Version 4.1.5
* Added dot for SD write operation
* Added statistics menu
* Added an overall configuration file
* Added M70 gcode for calibrate AC721 current sensor * Added M70 gcode for calibrate AC721 current sensor
* Added documentation for calibrate AC721 current sensor * Added documentation for calibrate AC721 current sensor
* Critical stepper motor frequency bugfix * Critical stepper motor frequency bugfix
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "boards.h" #include "boards.h"
#include "macros.h" #include "macros.h"
#include "Default_Version.h" #include "Default_Version.h"
#include "Configuration_Overall.h"
//=========================================================================== //===========================================================================
//============================= Getting Started ============================= //============================= Getting Started =============================
...@@ -61,23 +62,6 @@ ...@@ -61,23 +62,6 @@
//#define COREXZ //#define COREXZ
//#define DELTA //#define DELTA
//#define SCARA //#define SCARA
/***********************************************************************\
/***********************************************************************\
********************** Do not touch this section **********************
***********************************************************************/
#if ENABLED(CARTESIAN)
#include "Configuration_Cartesian.h"
#elif ENABLED(COREXY)
#include "Configuration_Core.h"
#elif ENABLED(COREXZ)
#include "Configuration_Core.h"
#elif ENABLED(DELTA)
#include "Configuration_Delta.h"
#elif ENABLED(SCARA)
#include "Configuration_Scara.h"
#endif
/***********************************************************************/
// This defines the number of extruder real or virtual // This defines the number of extruder real or virtual
#define EXTRUDERS 1 #define EXTRUDERS 1
...@@ -720,7 +704,24 @@ const bool FILRUNOUT_PIN_INVERTING = true; // Should be uncommented and true or ...@@ -720,7 +704,24 @@ const bool FILRUNOUT_PIN_INVERTING = true; // Should be uncommented and true or
//#define LASERBEAM //#define LASERBEAM
//=========================================================================== //===========================================================================
/***********************************************************************\
********************** Do not touch this section **********************
***********************************************************************/
#include "Configuration_Overall.h"
#if ENABLED(CARTESIAN)
#include "Configuration_Cartesian.h"
#elif ENABLED(COREXY)
#include "Configuration_Core.h"
#elif ENABLED(COREXZ)
#include "Configuration_Core.h"
#elif ENABLED(DELTA)
#include "Configuration_Delta.h"
#elif ENABLED(SCARA)
#include "Configuration_Scara.h"
#endif
#include "Configuration_Overall.h"
#include "Configuration_adv.h" #include "Configuration_adv.h"
#include "Configuration_Overall.h"
#include "thermistortables.h" #include "thermistortables.h"
/***********************************************************************/
#endif //__CONFIGURATION_H #endif //__CONFIGURATION_H
/**
* Configuration_Overall.h
* Here you can define all your custom settings and they will overwrite configurations in the main configuration files.
*/
\ No newline at end of file
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#define CONFIGURATION_ADV_H #define CONFIGURATION_ADV_H
#include "conditionals.h" #include "conditionals.h"
#include "Configuration_Overall.h"
//=========================================================================== //===========================================================================
//=============================Thermal Settings ============================ //=============================Thermal Settings ============================
//=========================================================================== //===========================================================================
...@@ -561,7 +561,13 @@ const unsigned int dropsegments = 5; // everything with less than this number of ...@@ -561,7 +561,13 @@ const unsigned int dropsegments = 5; // everything with less than this number of
#endif #endif
#include "Configuration_Overall.h"
#include "pins.h"
#include "Configuration_Overall.h"
#include "language.h"
#include "Configuration_Overall.h"
#include "conditionals.h" #include "conditionals.h"
#include "Configuration_Overall.h"
#include "sanitycheck.h" #include "sanitycheck.h"
#endif //CONFIGURATION_ADV_H #endif //CONFIGURATION_ADV_H
...@@ -854,6 +854,8 @@ void ConfigSD_ResetDefault() { ...@@ -854,6 +854,8 @@ void ConfigSD_ResetDefault() {
void ConfigSD_StoreSettings() { void ConfigSD_StoreSettings() {
if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting) return; if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting) return;
set_sd_dot();
delay(500);
card.setroot(true); card.setroot(true);
card.openFile(CFG_SD_FILE, false, true, false); card.openFile(CFG_SD_FILE, false, true, false);
char buff[CFG_SD_MAX_VALUE_LEN]; char buff[CFG_SD_MAX_VALUE_LEN];
...@@ -867,10 +869,14 @@ void ConfigSD_ResetDefault() { ...@@ -867,10 +869,14 @@ void ConfigSD_ResetDefault() {
card.closeFile(false); card.closeFile(false);
card.setlast(); card.setlast();
config_last_update = millis(); config_last_update = millis();
delay(500);
unset_sd_dot();
} }
void ConfigSD_RetrieveSettings(bool addValue) { void ConfigSD_RetrieveSettings(bool addValue) {
if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting || !card.cardOK) return; if(!IS_SD_INSERTED || card.isFileOpen() || card.sdprinting || !card.cardOK) return;
set_sd_dot();
delay(500);
char key[CFG_SD_MAX_KEY_LEN], value[CFG_SD_MAX_VALUE_LEN]; char key[CFG_SD_MAX_KEY_LEN], value[CFG_SD_MAX_VALUE_LEN];
int k_idx; int k_idx;
int k_len, v_len; int k_len, v_len;
...@@ -901,6 +907,8 @@ void ConfigSD_ResetDefault() { ...@@ -901,6 +907,8 @@ void ConfigSD_ResetDefault() {
card.closeFile(false); card.closeFile(false);
card.setlast(); card.setlast();
config_readed = true; config_readed = true;
delay(500);
unset_sd_dot();
} }
int ConfigSD_KeyIndex(char *key) { //At the moment a binary search algorithm is used for simplicity, if it will be necessary (Eg. tons of key), an hash search algorithm will be implemented. int ConfigSD_KeyIndex(char *key) { //At the moment a binary search algorithm is used for simplicity, if it will be necessary (Eg. tons of key), an hash search algorithm will be implemented.
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#define MSG_MBL_6 " BED leveled! " #define MSG_MBL_6 " BED leveled! "
#define MSG_SET_HOME_OFFSETS "Set home offsets" #define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Set origin" #define MSG_SET_ORIGIN "Set origin"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.er:"
#define MSG_PREHEAT_PLA "Preheat PLA" #define MSG_PREHEAT_PLA "Preheat PLA"
#define MSG_PREHEAT_PLA_ALL "Preheat PLA All" #define MSG_PREHEAT_PLA_ALL "Preheat PLA All"
#define MSG_PREHEAT_PLA_BEDONLY "Preheat PLA Bed" #define MSG_PREHEAT_PLA_BEDONLY "Preheat PLA Bed"
...@@ -68,6 +70,7 @@ ...@@ -68,6 +70,7 @@
#define MSG_FAN_SPEED "Fan speed" #define MSG_FAN_SPEED "Fan speed"
#define MSG_FLOW "Flow" #define MSG_FLOW "Flow"
#define MSG_CONTROL "Control" #define MSG_CONTROL "Control"
#define MSG_STATS "Statistics"
#define MSG_FIX_LOSE_STEPS "Fix axis steps" #define MSG_FIX_LOSE_STEPS "Fix axis steps"
#define MSG_MIN LCD_STR_THERMOMETER " Min" #define MSG_MIN LCD_STR_THERMOMETER " Min"
#define MSG_MAX LCD_STR_THERMOMETER " Max" #define MSG_MAX LCD_STR_THERMOMETER " Max"
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#define MSG_MBL_6 " Piatto livellato! " #define MSG_MBL_6 " Piatto livellato! "
#define MSG_SET_HOME_OFFSETS "Setta offset home" #define MSG_SET_HOME_OFFSETS "Setta offset home"
#define MSG_SET_ORIGIN "Imposta Origine" #define MSG_SET_ORIGIN "Imposta Origine"
#define MSG_ONFOR "On x:"
#define MSG_PWRCONSUMED "P.za:"
#define MSG_PREHEAT_PLA "Preriscalda PLA" #define MSG_PREHEAT_PLA "Preriscalda PLA"
#define MSG_PREHEAT_PLA_ALL "Prer. PLA Tutto" #define MSG_PREHEAT_PLA_ALL "Prer. PLA Tutto"
#define MSG_PREHEAT_PLA_BEDONLY "Prer. PLA Piatto" #define MSG_PREHEAT_PLA_BEDONLY "Prer. PLA Piatto"
...@@ -64,6 +66,7 @@ ...@@ -64,6 +66,7 @@
#define MSG_FAN_SPEED "Ventola" #define MSG_FAN_SPEED "Ventola"
#define MSG_FLOW "Flusso" #define MSG_FLOW "Flusso"
#define MSG_CONTROL "Controllo" #define MSG_CONTROL "Controllo"
#define MSG_STATS "Statistiche"
#define MSG_MIN LCD_STR_THERMOMETER " Min" #define MSG_MIN LCD_STR_THERMOMETER " Min"
#define MSG_MAX LCD_STR_THERMOMETER " Max" #define MSG_MAX LCD_STR_THERMOMETER " Max"
#define MSG_FACTOR LCD_STR_THERMOMETER " Fact" #define MSG_FACTOR LCD_STR_THERMOMETER " Fact"
......
...@@ -279,6 +279,10 @@ ...@@ -279,6 +279,10 @@
#endif #endif
#endif #endif
#if DISABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
#error You have to enable SDSUPPORT to use SD_SETTINGS
#endif
/** /**
* Warnings for old configurations * Warnings for old configurations
*/ */
......
...@@ -67,6 +67,7 @@ static void lcd_status_screen(); ...@@ -67,6 +67,7 @@ static void lcd_status_screen();
static void lcd_prepare_temperature_menu(); static void lcd_prepare_temperature_menu();
static void lcd_move_menu(); static void lcd_move_menu();
static void lcd_control_menu(); static void lcd_control_menu();
static void lcd_stats_menu();
static void lcd_control_temperature_menu(); static void lcd_control_temperature_menu();
static void lcd_control_temperature_preheat_pla_settings_menu(); static void lcd_control_temperature_preheat_pla_settings_menu();
static void lcd_control_temperature_preheat_abs_settings_menu(); static void lcd_control_temperature_preheat_abs_settings_menu();
...@@ -449,6 +450,8 @@ static void lcd_main_menu() { ...@@ -449,6 +450,8 @@ static void lcd_main_menu() {
} }
MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu); MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu);
MENU_ITEM(submenu, MSG_STATS, lcd_stats_menu);
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
if (card.cardOK) { if (card.cardOK) {
if (card.isFileOpen()) { if (card.isFileOpen()) {
...@@ -1045,6 +1048,24 @@ static void lcd_control_menu() { ...@@ -1045,6 +1048,24 @@ static void lcd_control_menu() {
END_MENU(); END_MENU();
} }
/**
*
* "Statistics" submenu
*
*/
static void lcd_stats_menu() {
char row[30];
int day = printer_usage_seconds / 60 / 60 / 24, hours = (printer_usage_seconds / 60 / 60) % 24, minutes = (printer_usage_seconds / 60) % 60;
sprintf_P(row, PSTR(MSG_ONFOR " %id %ih %im"), day, hours, minutes);
LCD_Printpos(0, 0); lcd_print(row);
#if HAS_POWER_CONSUMPTION_SENSOR
sprintf_P(row, PSTR(MSG_PWRCONSUMED " %iWh"), power_consumption_hour);
LCD_Printpos(0, 1); lcd_print(row);
#endif
if (LCD_CLICKED) lcd_goto_menu(lcd_main_menu);
}
/** /**
* *
* "Temperature" submenu * "Temperature" submenu
...@@ -1663,6 +1684,27 @@ int lcd_strlen_P(const char *s) { ...@@ -1663,6 +1684,27 @@ int lcd_strlen_P(const char *s) {
return j; return j;
} }
#if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
void set_sd_dot() {
u8g.firstPage();
do {
u8g.setColorIndex(1);
u8g.drawPixel(0, 0); // draw sd dot
u8g.setColorIndex(1); // black on white
(*currentMenu)();
} while( u8g.nextPage() );
}
void unset_sd_dot() {
u8g.firstPage();
do {
u8g.setColorIndex(0);
u8g.drawPixel(0, 0); // draw sd dot
u8g.setColorIndex(1); // black on white
(*currentMenu)();
} while( u8g.nextPage() );
}
#endif
/** /**
* Update the LCD, read encoder buttons, etc. * Update the LCD, read encoder buttons, etc.
* - Read button states * - Read button states
......
...@@ -49,6 +49,11 @@ ...@@ -49,6 +49,11 @@
FORCE_INLINE void lcd_buttons_update() {} FORCE_INLINE void lcd_buttons_update() {}
#endif #endif
#if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
extern void set_sd_dot();
extern void unset_sd_dot();
#endif
extern int plaPreheatHotendTemp; extern int plaPreheatHotendTemp;
extern int plaPreheatHPBTemp; extern int plaPreheatHPBTemp;
extern int plaPreheatFanSpeed; extern int plaPreheatFanSpeed;
......
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