Merge pull request #919 from PavelSindler/make_prep

Make prep
This commit is contained in:
PavelSindler 2018-07-11 22:03:05 +02:00 committed by GitHub
commit 9133f83b77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 9 deletions

View file

@ -848,6 +848,16 @@ void factory_reset(char level, bool quiet)
farm_mode = false;
eeprom_update_byte((uint8_t*)EEPROM_FARM_MODE, farm_mode);
EEPROM_save_B(EEPROM_FARM_NUMBER, &farm_no);
eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0);
eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0);
eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_X_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_CRASH_COUNT_Y_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_FERROR_COUNT_TOT, 0);
eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0);
fsensor_enable();
fautoload_set(true);
WRITE(BEEPER, HIGH);
_delay_ms(100);
@ -1142,10 +1152,6 @@ void list_sec_lang_from_external_flash()
// are initialized by the main() routine provided by the Arduino framework.
void setup()
{
#ifdef W25X20CL
// Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory.
optiboot_w25x20cl_enter();
#endif
lcd_init();
fdev_setup_stream(lcdout, lcd_putchar, NULL, _FDEV_SETUP_WRITE); //setup lcdout stream
@ -1153,6 +1159,11 @@ void setup()
lcd_splash();
#ifdef W25X20CL
// Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory.
optiboot_w25x20cl_enter();
#endif
#if (LANG_MODE != 0) //secondary language support
#ifdef W25X20CL
if (w25x20cl_init())
@ -3103,6 +3114,8 @@ void gcode_M701()
custom_message = true;
custom_message_type = 2;
if (current_position[Z_AXIS] < 20) current_position[Z_AXIS] += 30;
lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT));
current_position[E_AXIS] += 70;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 400 / 60, active_extruder); //fast sequence

View file

@ -86,6 +86,12 @@ void fsensor_disable()
FSensorStateMenu = 0;
}
void fautoload_set(bool State)
{
filament_autoload_enabled = State;
eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, filament_autoload_enabled);
}
void pciSetup(byte pin)
{
*digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin

View file

@ -15,6 +15,9 @@ extern void fsensor_unblock();
extern bool fsensor_enable();
extern void fsensor_disable();
extern bool filament_autoload_enabled;
extern void fautoload_set(bool State);
//update (perform M600 on filament runout)
extern void fsensor_update();

View file

@ -1,5 +1,6 @@
#include "temperature.h"
#include "ultralcd.h"
#include "fsensor.h"
#ifdef ULTRA_LCD
#include "MenuStack.h"
#include "Marlin.h"
@ -1845,8 +1846,7 @@ void lcd_set_fan_check() {
}
void lcd_set_filament_autoload() {
filament_autoload_enabled = !filament_autoload_enabled;
eeprom_update_byte((unsigned char *)EEPROM_FSENS_AUTOLOAD_ENABLED, filament_autoload_enabled);
fautoload_set(!filament_autoload_enabled);
}
void lcd_unLoadFilament()
@ -2110,7 +2110,7 @@ void lcd_menu_statistics()
{
if (IS_SD_PRINTING)
{
int _met = total_filament_used / 100000;
float _met = ((float)total_filament_used) / (100000.f);
int _cm = (total_filament_used - (_met * 100000)) / 10;
int _t = (millis() - starttime) / 1000;
int _h = _t / 3600;
@ -2125,12 +2125,12 @@ void lcd_menu_statistics()
lcd_printf_P(_N(
ESC_2J
"%S:"
ESC_H(6,1) "%8.2f m\n"
ESC_H(6,1) "%8.2fm \n"
"%S :"
ESC_H(8,3) "%2dh %02dm %02d"
),
_i("Filament used"),
_met, _cm,
_met,
_i("Print time"),
_h, _m, _s
);