Commit 4dd5fb50 authored by Simone Primarosa's avatar Simone Primarosa

Added ability to write configuration on SD

parent 78be2cbd
...@@ -406,7 +406,10 @@ bool target_direction; ...@@ -406,7 +406,10 @@ bool target_direction;
#ifdef SDSUPPORT #ifdef SDSUPPORT
static bool fromsd[BUFSIZE]; static bool fromsd[BUFSIZE];
#endif //!SDSUPPORT #ifdef SD_SETTINGS
unsigned long config_last_update = 0;
#endif
#endif
#ifdef FILAMENTCHANGEENABLE #ifdef FILAMENTCHANGEENABLE
bool filament_changing = false; bool filament_changing = false;
...@@ -751,6 +754,18 @@ void setup() { ...@@ -751,6 +754,18 @@ void setup() {
setup_photpin(); setup_photpin();
setup_laserbeampin(); // Initialize Laserbeam pin setup_laserbeampin(); // Initialize Laserbeam pin
servo_init(); servo_init();
#ifdef SDSUPPORT
card.initsd();
#endif
// loads custom configuration from SDCARD if available else uses defaults
#ifdef SDSTUPPORT
if(!IS_SD_INSERTED) ConfigSD_ResetDefault();
else
#endif
{
ConfigSD_RetrieveSettings();
}
lcd_init(); lcd_init();
_delay_ms(1000); // wait 1sec to display the splash screen _delay_ms(1000); // wait 1sec to display the splash screen
...@@ -6872,7 +6887,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { ...@@ -6872,7 +6887,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
if (!filament_changing) if (!filament_changing)
#endif #endif
{ {
if(degHotend(active_extruder) < IDLE_OOZING_MAXTEMP && degTargetHotend(active_extruder) < IDLE_OOZING_MINTEMP) { if(degTargetHotend(active_extruder) < IDLE_OOZING_MINTEMP) {
IDLE_OOZING_retract(false); IDLE_OOZING_retract(false);
} }
else if((millis() - axis_last_activity) > IDLE_OOZING_SECONDS*1000) { else if((millis() - axis_last_activity) > IDLE_OOZING_SECONDS*1000) {
...@@ -6882,6 +6897,18 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) { ...@@ -6882,6 +6897,18 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
} }
#endif #endif
#if defined(SDSUPPORT) && defined(SD_SETTINGS)
if(!config_readed) {
ConfigSD_RetrieveSettings(true);
}
else if((millis() - config_last_update) > SD_CFG_SECONDS*1000) {
ConfigSD_StoreSettings();
}
#endif
#ifdef TEMP_STAT_LEDS
handle_status_leds();
#endif
#ifdef TEMP_STAT_LEDS #ifdef TEMP_STAT_LEDS
handle_status_leds(); handle_status_leds();
#endif #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