Add files via upload

This commit is contained in:
MRprusa3d 2018-07-20 04:34:12 +00:00 committed by GitHub
parent a09d44b869
commit bbec1ccfd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 549 additions and 329 deletions

View File

@ -44,182 +44,8 @@
#define FW_PRUSA3D_MAGIC "PRUSA3DFW" #define FW_PRUSA3D_MAGIC "PRUSA3DFW"
#define FW_PRUSA3D_MAGIC_LEN 10 #define FW_PRUSA3D_MAGIC_LEN 10
// The total size of the EEPROM is
// 4096 for the Atmega2560
#define EEPROM_TOP 4096
#define EEPROM_SILENT 4095
#define EEPROM_LANG 4094
#define EEPROM_BABYSTEP_X 4092
#define EEPROM_BABYSTEP_Y 4090
#define EEPROM_BABYSTEP_Z 4088
#define EEPROM_CALIBRATION_STATUS 4087
#define EEPROM_BABYSTEP_Z0 4085
#define EEPROM_FILAMENTUSED 4081
// uint32_t
#define EEPROM_TOTALTIME 4077
#define EEPROM_BED_CALIBRATION_CENTER (EEPROM_TOTALTIME-2*4) #include "eeprom.h"
#define EEPROM_BED_CALIBRATION_VEC_X (EEPROM_BED_CALIBRATION_CENTER-2*4)
#define EEPROM_BED_CALIBRATION_VEC_Y (EEPROM_BED_CALIBRATION_VEC_X-2*4)
// Offsets of the Z heiths of the calibration points from the first point.
// The offsets are saved as 16bit signed int, scaled to tenths of microns.
#define EEPROM_BED_CALIBRATION_Z_JITTER (EEPROM_BED_CALIBRATION_VEC_Y-2*8)
#define EEPROM_FARM_MODE (EEPROM_BED_CALIBRATION_Z_JITTER-1)
#define EEPROM_FARM_NUMBER (EEPROM_FARM_MODE-3)
// Correction of the bed leveling, in micrometers.
// Maximum 50 micrometers allowed.
// Bed correction is valid if set to 1. If set to zero or 255, the successive 4 bytes are invalid.
#define EEPROM_BED_CORRECTION_VALID (EEPROM_FARM_NUMBER-1)
#define EEPROM_BED_CORRECTION_LEFT (EEPROM_BED_CORRECTION_VALID-1)
#define EEPROM_BED_CORRECTION_RIGHT (EEPROM_BED_CORRECTION_LEFT-1)
#define EEPROM_BED_CORRECTION_FRONT (EEPROM_BED_CORRECTION_RIGHT-1)
#define EEPROM_BED_CORRECTION_REAR (EEPROM_BED_CORRECTION_FRONT-1)
#define EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY (EEPROM_BED_CORRECTION_REAR-1)
#define EEPROM_PRINT_FLAG (EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY-1)
#define EEPROM_PROBE_TEMP_SHIFT (EEPROM_PRINT_FLAG - 2*5) //5 x int for storing pinda probe temp shift relative to 50 C; unit: motor steps
#define EEPROM_TEMP_CAL_ACTIVE (EEPROM_PROBE_TEMP_SHIFT - 1)
#define EEPROM_BOWDEN_LENGTH (EEPROM_TEMP_CAL_ACTIVE - 2*4) //4 x int for bowden lengths for multimaterial
#define EEPROM_CALIBRATION_STATUS_PINDA (EEPROM_BOWDEN_LENGTH - 1) //0 - not calibrated; 1 - calibrated
#define EEPROM_UVLO (EEPROM_CALIBRATION_STATUS_PINDA - 1) //1 - uvlo during print
#define EEPROM_UVLO_CURRENT_POSITION (EEPROM_UVLO-2*4) // 2 x float for current_position in X and Y axes
#define EEPROM_FILENAME (EEPROM_UVLO_CURRENT_POSITION - 8) //8chars to store filename without extension
#define EEPROM_FILE_POSITION (EEPROM_FILENAME - 4) //32 bit for uint32_t file position
#define EEPROM_UVLO_CURRENT_POSITION_Z (EEPROM_FILE_POSITION - 4) //float for current position in Z
#define EEPROM_UVLO_TARGET_HOTEND (EEPROM_UVLO_CURRENT_POSITION_Z - 1)
#define EEPROM_UVLO_TARGET_BED (EEPROM_UVLO_TARGET_HOTEND - 1)
#define EEPROM_UVLO_FEEDRATE (EEPROM_UVLO_TARGET_BED - 2)
#define EEPROM_UVLO_FAN_SPEED (EEPROM_UVLO_FEEDRATE - 1)
#define EEPROM_FAN_CHECK_ENABLED (EEPROM_UVLO_FAN_SPEED - 1)
#define EEPROM_UVLO_MESH_BED_LEVELING (EEPROM_FAN_CHECK_ENABLED - 9*2)
#define EEPROM_UVLO_Z_MICROSTEPS (EEPROM_UVLO_MESH_BED_LEVELING - 2)
#define EEPROM_UVLO_E_ABS (EEPROM_UVLO_Z_MICROSTEPS - 1)
#define EEPROM_UVLO_CURRENT_POSITION_E (EEPROM_UVLO_E_ABS - 4) //float for current position in E
// Crash detection mode EEPROM setting
#define EEPROM_CRASH_DET (EEPROM_UVLO_CURRENT_POSITION_E - 5) // float (orig EEPROM_UVLO_MESH_BED_LEVELING-12)
// Crash detection counter Y (last print)
#define EEPROM_CRASH_COUNT_Y (EEPROM_CRASH_DET - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-15)
// Filament sensor on/off EEPROM setting
#define EEPROM_FSENSOR (EEPROM_CRASH_COUNT_Y - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-14)
// Crash detection counter X (last print)
#define EEPROM_CRASH_COUNT_X (EEPROM_FSENSOR - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-15)
// Filament runout/error coutner (last print)
#define EEPROM_FERROR_COUNT (EEPROM_CRASH_COUNT_X - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-16)
// Power loss errors (last print)
#define EEPROM_POWER_COUNT (EEPROM_FERROR_COUNT - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-17)
#define EEPROM_XYZ_CAL_SKEW (EEPROM_POWER_COUNT - 4) // float for skew backup
#define EEPROM_WIZARD_ACTIVE (EEPROM_XYZ_CAL_SKEW - 1)
#define EEPROM_BELTSTATUS_X (EEPROM_WIZARD_ACTIVE - 2) // uint16
#define EEPROM_BELTSTATUS_Y (EEPROM_BELTSTATUS_X - 2) // uint16
#define EEPROM_DIR_DEPTH (EEPROM_BELTSTATUS_Y-1)
#define EEPROM_DIRS (EEPROM_DIR_DEPTH-80) //8 chars for each dir name, max 10 levels
#define EEPROM_SD_SORT (EEPROM_DIRS - 1) //0 -time, 1-alpha, 2-none
#define EEPROM_SECOND_SERIAL_ACTIVE (EEPROM_SD_SORT - 1)
#define EEPROM_FSENS_AUTOLOAD_ENABLED (EEPROM_SECOND_SERIAL_ACTIVE - 1)
// Crash detection counter X (total)
#define EEPROM_CRASH_COUNT_X_TOT (EEPROM_FSENS_AUTOLOAD_ENABLED - 2) // uint16
// Crash detection counter Y (total)
#define EEPROM_CRASH_COUNT_Y_TOT (EEPROM_CRASH_COUNT_X_TOT - 2) // uint16
// Filament runout/error coutner (total)
#define EEPROM_FERROR_COUNT_TOT (EEPROM_CRASH_COUNT_Y_TOT - 2) // uint16
// Power loss errors (total)
#define EEPROM_POWER_COUNT_TOT (EEPROM_FERROR_COUNT_TOT - 2) // uint16
////////////////////////////////////////
// TMC2130 Accurate sensorless homing
// X-axis home origin (stepper phase in microsteps, 0..63 for 16ustep resolution)
#define EEPROM_TMC2130_HOME_X_ORIGIN (EEPROM_POWER_COUNT_TOT - 1) // uint8
// X-axis home bsteps (number of microsteps backward)
#define EEPROM_TMC2130_HOME_X_BSTEPS (EEPROM_TMC2130_HOME_X_ORIGIN - 1) // uint8
// X-axis home fsteps (number of microsteps forward)
#define EEPROM_TMC2130_HOME_X_FSTEPS (EEPROM_TMC2130_HOME_X_BSTEPS - 1) // uint8
// Y-axis home origin (stepper phase in microsteps, 0..63 for 16ustep resolution)
#define EEPROM_TMC2130_HOME_Y_ORIGIN (EEPROM_TMC2130_HOME_X_FSTEPS - 1) // uint8
// X-axis home bsteps (number of microsteps backward)
#define EEPROM_TMC2130_HOME_Y_BSTEPS (EEPROM_TMC2130_HOME_Y_ORIGIN - 1) // uint8
// X-axis home fsteps (number of microsteps forward)
#define EEPROM_TMC2130_HOME_Y_FSTEPS (EEPROM_TMC2130_HOME_Y_BSTEPS - 1) // uint8
// Accurate homing enabled
#define EEPROM_TMC2130_HOME_ENABLED (EEPROM_TMC2130_HOME_Y_FSTEPS - 1) // uint8
////////////////////////////////////////
// TMC2130 uStep linearity correction
// Linearity correction factor (XYZE)
#define EEPROM_TMC2130_WAVE_X_FAC (EEPROM_TMC2130_HOME_ENABLED - 1) // uint8
#define EEPROM_TMC2130_WAVE_Y_FAC (EEPROM_TMC2130_WAVE_X_FAC - 1) // uint8
#define EEPROM_TMC2130_WAVE_Z_FAC (EEPROM_TMC2130_WAVE_Y_FAC - 1) // uint8
#define EEPROM_TMC2130_WAVE_E_FAC (EEPROM_TMC2130_WAVE_Z_FAC - 1) // uint8
////////////////////////////////////////
// TMC2130 uStep resolution
// microstep resolution (XYZE): usteps = (256 >> mres)
#define EEPROM_TMC2130_X_MRES (EEPROM_TMC2130_WAVE_E_FAC - 1) // uint8
#define EEPROM_TMC2130_Y_MRES (EEPROM_TMC2130_X_MRES - 1) // uint8
#define EEPROM_TMC2130_Z_MRES (EEPROM_TMC2130_Y_MRES - 1) // uint8
#define EEPROM_TMC2130_E_MRES (EEPROM_TMC2130_Z_MRES - 1) // uint8
// HW
#define EEPROM_PRINTER_TYPE (EEPROM_TMC2130_E_MRES - 2) // uint16
#define EEPROM_BOARD_TYPE (EEPROM_PRINTER_TYPE - 2) // uint16
// Extruder multiplier for power panic
#define EEPROM_EXTRUDER_MULTIPLIER_0 (EEPROM_BOARD_TYPE - 4) //float
#define EEPROM_EXTRUDER_MULTIPLIER_1 (EEPROM_EXTRUDER_MULTIPLIER_0 - 4) //float
#define EEPROM_EXTRUDER_MULTIPLIER_2 (EEPROM_EXTRUDER_MULTIPLIER_1 - 4) //float
#define EEPROM_EXTRUDEMULTIPLY (EEPROM_EXTRUDER_MULTIPLIER_2 - 2) // uint16
//
#define EEPROM_UVLO_TINY_CURRENT_POSITION_Z (EEPROM_EXTRUDEMULTIPLY-4) // float
#define EEPROM_UVLO_TINY_Z_MICROSTEPS (EEPROM_UVLO_TINY_CURRENT_POSITION_Z-2) // uint16
//TMC2130 configuration
#define EEPROM_TMC_AXIS_SIZE //axis configuration block size
#define EEPROM_TMC_X (EEPROM_TMC + 0 * EEPROM_TMC_AXIS_SIZE) //X axis configuration blok
#define EEPROM_TMC_Y (EEPROM_TMC + 1 * EEPROM_TMC_AXIS_SIZE) //Y axis
#define EEPROM_TMC_Z (EEPROM_TMC + 2 * EEPROM_TMC_AXIS_SIZE) //Z axis
#define EEPROM_TMC_E (EEPROM_TMC + 3 * EEPROM_TMC_AXIS_SIZE) //E axis
//TMC2130 - X axis
#define EEPROM_TMC_X_USTEPS_INTPOL (EEPROM_TMC_X + 0) // 1byte, bit 0..4 USTEPS, bit 7 INTPOL
#define EEPROM_TMC_X_PWM_AMPL (EEPROM_TMC_X + 1) // 1byte (0..255)
#define EEPROM_TMC_X_PWM_GRAD_FREQ (EEPROM_TMC_X + 2) // 1byte, bit 0..3 GRAD, bit 4..5 FREQ
#define EEPROM_TMC_X_TCOOLTHRS (EEPROM_TMC_X + 3) // 2bytes (0..)
#define EEPROM_TMC_X_SG_THRS (EEPROM_TMC_X + 5) // 1byte, (-64..+63)
#define EEPROM_TMC_X_CURRENT_H (EEPROM_TMC_X + 6) // 1byte, (0..63)
#define EEPROM_TMC_X_CURRENT_R (EEPROM_TMC_X + 7) // 1byte, (0..63)
#define EEPROM_TMC_X_HOME_SG_THRS (EEPROM_TMC_X + 8) // 1byte, (-64..+63)
#define EEPROM_TMC_X_HOME_CURRENT_R (EEPROM_TMC_X + 9) // 1byte, (-64..+63)
#define EEPROM_TMC_X_HOME_DTCOOLTHRS (EEPROM_TMC_X + 10) // 1byte (-128..+127)
#define EEPROM_TMC_X_DTCOOLTHRS_LOW (EEPROM_TMC_X + 11) // 1byte (-128..+127)
#define EEPROM_TMC_X_DTCOOLTHRS_HIGH (EEPROM_TMC_X + 12) // 1byte (-128..+127)
#define EEPROM_TMC_X_SG_THRS_LOW (EEPROM_TMC_X + 13) // 1byte, (-64..+63)
#define EEPROM_TMC_X_SG_THRS_HIGH (EEPROM_TMC_X + 14) // 1byte, (-64..+63)
// Currently running firmware, each digit stored as uint16_t.
// The flavor differentiates a dev, alpha, beta, release candidate or a release version.
#define EEPROM_FIRMWARE_VERSION_END (FW_PRUSA3D_MAGIC_LEN+8)
#define EEPROM_FIRMWARE_VERSION_FLAVOR (FW_PRUSA3D_MAGIC_LEN+6)
#define EEPROM_FIRMWARE_VERSION_REVISION (FW_PRUSA3D_MAGIC_LEN+4)
#define EEPROM_FIRMWARE_VERSION_MINOR (FW_PRUSA3D_MAGIC_LEN+2)
#define EEPROM_FIRMWARE_VERSION_MAJOR FW_PRUSA3D_MAGIC_LEN
// Magic string, indicating that the current or the previous firmware running was the Prusa3D firmware.
#define EEPROM_FIRMWARE_PRUSA_MAGIC 0
#define EEPROM_OFFSET 20 //offset for storing settings using M500
//#define EEPROM_OFFSET
// This configuration file contains the basic settings. // This configuration file contains the basic settings.
// Advanced settings can be found in Configuration_adv.h // Advanced settings can be found in Configuration_adv.h

View File

@ -126,6 +126,8 @@
#include "ultralcd.h" #include "ultralcd.h"
//-//
#include "sound.h"
#include "cmdqueue.h" #include "cmdqueue.h"
@ -484,9 +486,7 @@ static float feedrate = 1500.0, next_feedrate, saved_feedrate;
// Also there is bool axis_relative_modes[] per axis flag. // Also there is bool axis_relative_modes[] per axis flag.
static bool relative_mode = false; static bool relative_mode = false;
#ifndef _DISABLE_M42_M226
const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42 const int sensitive_pins[] = SENSITIVE_PINS; // Sensitive pin list for M42
#endif //_DISABLE_M42_M226
//static float tt = 0; //static float tt = 0;
//static float bt = 0; //static float bt = 0;
@ -858,7 +858,7 @@ void factory_reset(char level, bool quiet)
eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0); eeprom_update_word((uint16_t *)EEPROM_POWER_COUNT_TOT, 0);
fsensor_enable(); fsensor_enable();
fautoload_set(true); fsensor_autoload_set(true);
WRITE(BEEPER, HIGH); WRITE(BEEPER, HIGH);
_delay_ms(100); _delay_ms(100);
@ -1151,6 +1151,8 @@ void setup()
spi_init(); spi_init();
lcd_splash(); lcd_splash();
//-//
Sound_Init();
#ifdef W25X20CL #ifdef W25X20CL
// Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory. // Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory.
@ -1378,7 +1380,6 @@ void setup()
#ifdef TMC2130 #ifdef TMC2130
uint8_t silentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT); uint8_t silentMode = eeprom_read_byte((uint8_t*)EEPROM_SILENT);
if (silentMode == 0xff) silentMode = 0; if (silentMode == 0xff) silentMode = 0;
// tmc2130_mode = silentMode?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL;
tmc2130_mode = TMC2130_MODE_NORMAL; tmc2130_mode = TMC2130_MODE_NORMAL;
uint8_t crashdet = eeprom_read_byte((uint8_t*)EEPROM_CRASH_DET); uint8_t crashdet = eeprom_read_byte((uint8_t*)EEPROM_CRASH_DET);
if (crashdet && !farm_mode) if (crashdet && !farm_mode)
@ -1432,6 +1433,7 @@ void setup()
#ifdef TMC2130 #ifdef TMC2130
tmc2130_mode = silentMode?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL; tmc2130_mode = silentMode?TMC2130_MODE_SILENT:TMC2130_MODE_NORMAL;
update_mode_profile();
tmc2130_init(); tmc2130_init();
#endif //TMC2130 #endif //TMC2130
@ -1725,11 +1727,7 @@ void setup()
#endif //TMC2130 #endif //TMC2130
#ifdef UVLO_SUPPORT #ifdef UVLO_SUPPORT
//-// if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 1) { //previous print was terminated by UVLO
MYSERIAL.println(">>> Setup");
MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_UVLO),DEC);
// if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 1) { //previous print was terminated by UVLO
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO) != 0) { //previous print was terminated by UVLO
/* /*
if (lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false)) recover_print(); if (lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false)) recover_print();
else { else {
@ -1755,8 +1753,7 @@ MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_UVLO),DEC);
#endif #endif
if ( lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false) ) recover_print(0); if ( lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_RECOVER_PRINT), false) ) recover_print(0);
else { else {
//-// eeprom_update_byte((uint8_t*)EEPROM_UVLO, 0);
// eeprom_update_byte((uint8_t*)EEPROM_UVLO, 0);
lcd_update_enable(true); lcd_update_enable(true);
lcd_update(2); lcd_update(2);
lcd_setstatuspgm(_T(WELCOME_MSG)); lcd_setstatuspgm(_T(WELCOME_MSG));
@ -2605,6 +2602,7 @@ void force_high_power_mode(bool start_high_power_section) {
st_synchronize(); st_synchronize();
cli(); cli();
tmc2130_mode = (start_high_power_section == true) ? TMC2130_MODE_NORMAL : TMC2130_MODE_SILENT; tmc2130_mode = (start_high_power_section == true) ? TMC2130_MODE_NORMAL : TMC2130_MODE_SILENT;
update_mode_profile();
tmc2130_init(); tmc2130_init();
// We may have missed a stepper timer interrupt due to the time spent in the tmc2130_init() routine. // We may have missed a stepper timer interrupt due to the time spent in the tmc2130_init() routine.
// Be safe than sorry, reset the stepper timer before re-enabling interrupts. // Be safe than sorry, reset the stepper timer before re-enabling interrupts.
@ -3113,14 +3111,22 @@ void gcode_M114()
void gcode_M701() void gcode_M701()
{ {
#ifdef SNMM printf_P(PSTR("gcode_M701 begin\n"));
#if defined (SNMM) || defined (SNMM_V2)
extr_adj(snmm_extruder);//loads current extruder extr_adj(snmm_extruder);//loads current extruder
#else #else
enable_z(); enable_z();
custom_message = true; custom_message = true;
custom_message_type = 2; custom_message_type = 2;
bool old_watch_runout = fsensor_watch_runout;
fsensor_watch_runout = false;
fsensor_st_sum = 0;
fsensor_yd_sum = 0;
fsensor_er_sum = 0;
fsensor_yd_min = 255;
fsensor_yd_max = 0;
lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT)); lcd_setstatuspgm(_T(MSG_LOADING_FILAMENT));
current_position[E_AXIS] += 40; current_position[E_AXIS] += 40;
@ -3162,6 +3168,11 @@ void gcode_M701()
custom_message_type = 0; custom_message_type = 0;
#endif #endif
fsensor_err_cnt = 0;
fsensor_watch_runout = old_watch_runout;
printf_P(_N("\nFSENSOR st_sum=%lu yd_sum=%lu er_sum=%lu\n"), fsensor_st_sum, fsensor_yd_sum, fsensor_er_sum);
printf_P(_N("\nFSENSOR yd_min=%hhu yd_max=%hhu yd_avg=%hhu\n"), fsensor_yd_min, fsensor_yd_max, fsensor_yd_sum * FSENSOR_CHUNK_LEN / fsensor_st_sum);
printf_P(PSTR("gcode_M701 end\n"));
} }
/** /**
* @brief Get serial number from 32U2 processor * @brief Get serial number from 32U2 processor
@ -3369,7 +3380,13 @@ void process_commands()
} }
else if (code_seen("thx")) { else if (code_seen("thx")) {
no_response = false; no_response = false;
} else if (code_seen("RESET")) { }
else if (code_seen("MMURES")) {
fprintf_P(uart2io, PSTR("X0"));
bool response = mmu_get_reponse();
if (!response) mmu_not_responding();
}
else if (code_seen("RESET")) {
// careful! // careful!
if (farm_mode) { if (farm_mode) {
#ifdef WATCHDOG #ifdef WATCHDOG
@ -4766,8 +4783,6 @@ void process_commands()
card.openFile(strchr_pointer + 4,true); card.openFile(strchr_pointer + 4,true);
break; break;
case 24: //M24 - Start SD print case 24: //M24 - Start SD print
//-//
eeprom_update_byte((uint8_t*)EEPROM_UVLO,0);
if (!card.paused) if (!card.paused)
failstats_reset_print(); failstats_reset_print();
card.startFileprint(); card.startFileprint();
@ -4871,7 +4886,6 @@ eeprom_update_byte((uint8_t*)EEPROM_UVLO,0);
autotempShutdown(); autotempShutdown();
} }
break; break;
#ifndef _DISABLE_M42_M226
case 42: //M42 -Change pin status via gcode case 42: //M42 -Change pin status via gcode
if (code_seen('S')) if (code_seen('S'))
{ {
@ -4899,7 +4913,6 @@ eeprom_update_byte((uint8_t*)EEPROM_UVLO,0);
} }
} }
break; break;
#endif //_DISABLE_M42_M226
case 44: // M44: Prusa3D: Reset the bed skew and offset calibration. case 44: // M44: Prusa3D: Reset the bed skew and offset calibration.
// Reset the baby step value and the baby step applied flag. // Reset the baby step value and the baby step applied flag.
@ -5765,16 +5778,29 @@ Sigma_Exit:
} }
break; break;
case 201: // M201 case 201: // M201
for(int8_t i=0; i < NUM_AXIS; i++) for (int8_t i = 0; i < NUM_AXIS; i++)
{ {
if(code_seen(axis_codes[i])) if (code_seen(axis_codes[i]))
{ {
max_acceleration_units_per_sq_second[i] = code_value(); int val = code_value();
} #ifdef TMC2130
} if ((i == X_AXIS) || (i == Y_AXIS))
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner) {
reset_acceleration_rates(); int max_val = 0;
break; if (tmc2130_mode == TMC2130_MODE_NORMAL)
max_val = NORMAL_MAX_ACCEL_XY;
else if (tmc2130_mode == TMC2130_MODE_SILENT)
max_val = SILENT_MAX_ACCEL_XY;
if (val > max_val)
val = max_val;
}
#endif
max_acceleration_units_per_sq_second[i] = val;
}
}
// steps per sq second need to be updated to agree with the units per sq second (as they are what is used in the planner)
reset_acceleration_rates();
break;
#if 0 // Not used for Sprinter/grbl gen6 #if 0 // Not used for Sprinter/grbl gen6
case 202: // M202 case 202: // M202
for(int8_t i=0; i < NUM_AXIS; i++) { for(int8_t i=0; i < NUM_AXIS; i++) {
@ -5783,10 +5809,27 @@ Sigma_Exit:
break; break;
#endif #endif
case 203: // M203 max feedrate mm/sec case 203: // M203 max feedrate mm/sec
for(int8_t i=0; i < NUM_AXIS; i++) { for (int8_t i = 0; i < NUM_AXIS; i++)
if(code_seen(axis_codes[i])) max_feedrate[i] = code_value(); {
} if (code_seen(axis_codes[i]))
break; {
float val = code_value();
#ifdef TMC2130
if ((i == X_AXIS) || (i == Y_AXIS))
{
float max_val = 0;
if (tmc2130_mode == TMC2130_MODE_NORMAL)
max_val = NORMAL_MAX_FEEDRATE_XY;
else if (tmc2130_mode == TMC2130_MODE_SILENT)
max_val = SILENT_MAX_FEEDRATE_XY;
if (val > max_val)
val = max_val;
}
#endif //TMC2130
max_feedrate[i] = val;
}
}
break;
case 204: // M204 acclereration S normal moves T filmanent only moves case 204: // M204 acclereration S normal moves T filmanent only moves
{ {
if(code_seen('S')) acceleration = code_value() ; if(code_seen('S')) acceleration = code_value() ;
@ -5933,7 +5976,6 @@ Sigma_Exit:
} }
break; break;
#ifndef _DISABLE_M42_M226
case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required case 226: // M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
{ {
if(code_seen('P')){ if(code_seen('P')){
@ -5985,7 +6027,6 @@ Sigma_Exit:
} }
} }
break; break;
#endif //_DISABLE_M42_M226
#if NUM_SERVOS > 0 #if NUM_SERVOS > 0
case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds case 280: // M280 - set servo position absolute. P: servo index, S: angle or microseconds
@ -6228,7 +6269,7 @@ Sigma_Exit:
{ {
#ifdef PAT9125 #ifdef PAT9125
bool old_fsensor_enabled = fsensor_enabled; bool old_fsensor_enabled = fsensor_enabled;
fsensor_enabled = false; //temporary solution for unexpected restarting // fsensor_enabled = false; //temporary solution for unexpected restarting
#endif //PAT9125 #endif //PAT9125
st_synchronize(); st_synchronize();
@ -6322,6 +6363,8 @@ Sigma_Exit:
unsigned long waiting_start_time = millis(); unsigned long waiting_start_time = millis();
uint8_t wait_for_user_state = 0; uint8_t wait_for_user_state = 0;
lcd_display_message_fullscreen_P(_T(MSG_PRESS_TO_UNLOAD)); lcd_display_message_fullscreen_P(_T(MSG_PRESS_TO_UNLOAD));
//-//
bool bFirst=true;
while (!(wait_for_user_state == 0 && lcd_clicked())){ while (!(wait_for_user_state == 0 && lcd_clicked())){
//cnt++; //cnt++;
@ -6342,7 +6385,13 @@ Sigma_Exit:
} }
SET_OUTPUT(BEEPER); SET_OUTPUT(BEEPER);
if (counterBeep == 0) { if (counterBeep == 0) {
//-//
//if(eSoundMode==e_SOUND_MODE_LOUD)
if((eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst))
{
bFirst=false;
WRITE(BEEPER, HIGH); WRITE(BEEPER, HIGH);
}
} }
if (counterBeep == 20) { if (counterBeep == 20) {
WRITE(BEEPER, LOW); WRITE(BEEPER, LOW);
@ -6479,13 +6528,22 @@ Sigma_Exit:
//finish moves //finish moves
st_synchronize(); st_synchronize();
lcd_display_message_fullscreen_P(_T(MSG_PULL_OUT_FILAMENT));
//disable extruder steppers so filament can be removed //disable extruder steppers so filament can be removed
disable_e0(); disable_e0();
disable_e1(); disable_e1();
disable_e2(); disable_e2();
delay(100); delay(100);
#ifdef SNMM_V2
fprintf_P(uart2io, PSTR("U0\n"));
// get response
bool response = mmu_get_reponse();
if (!response) mmu_not_responding();
#else
lcd_display_message_fullscreen_P(_T(MSG_PULL_OUT_FILAMENT));
WRITE(BEEPER, HIGH); WRITE(BEEPER, HIGH);
@ -6496,6 +6554,7 @@ Sigma_Exit:
counterBeep++; counterBeep++;
} }
WRITE(BEEPER, LOW); WRITE(BEEPER, LOW);
#endif
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
lcd_change_fil_state = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Was filament unload successful?"), false, true);////MSG_UNLOAD_SUCCESSFUL c=20 r=2 lcd_change_fil_state = lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Was filament unload successful?"), false, true);////MSG_UNLOAD_SUCCESSFUL c=20 r=2
@ -6509,15 +6568,14 @@ Sigma_Exit:
KEEPALIVE_STATE(PAUSED_FOR_USER); KEEPALIVE_STATE(PAUSED_FOR_USER);
#ifdef PAT9125 #ifdef PAT9125
if (filament_autoload_enabled && (old_fsensor_enabled || fsensor_M600)) fsensor_autoload_check_start(); if (filament_autoload_enabled && (old_fsensor_enabled || !fsensor_watch_runout)) fsensor_autoload_check_start();
#endif //PAT9125 #endif //PAT9125
// printf_P(PSTR("M600 PAT9125 filament_autoload_enabled=%d, old_fsensor_enabled=%d, fsensor_M600=%d"), filament_autoload_enabled, old_fsensor_enabled, fsensor_M600);
while(!lcd_clicked()) while(!lcd_clicked())
{ {
manage_heater(); manage_heater();
manage_inactivity(true); manage_inactivity(true);
#ifdef PAT9125 #ifdef PAT9125
if (filament_autoload_enabled && (old_fsensor_enabled || fsensor_M600) && fsensor_check_autoload()) if (filament_autoload_enabled && (old_fsensor_enabled || !fsensor_watch_runout) && fsensor_check_autoload())
{ {
tone(BEEPER, 1000); tone(BEEPER, 1000);
delay_keep_alive(50); delay_keep_alive(50);
@ -6533,7 +6591,7 @@ Sigma_Exit:
} }
#ifdef PAT9125 #ifdef PAT9125
if (filament_autoload_enabled && (old_fsensor_enabled || fsensor_M600)) fsensor_autoload_check_stop(); if (filament_autoload_enabled && (old_fsensor_enabled || !fsensor_watch_runout)) fsensor_autoload_check_stop();
#endif //PAT9125 #endif //PAT9125
//WRITE(BEEPER, LOW); //WRITE(BEEPER, LOW);
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
@ -6565,14 +6623,19 @@ Sigma_Exit:
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder); plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 400, active_extruder);
target[E_AXIS] += 10; target[E_AXIS] += 10;
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder); plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], 50, active_extruder);
//Extrude some filament
target[E_AXIS]+= FILAMENTCHANGE_FINALFEED ;
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EXFEED, active_extruder);
#else #else
target[E_AXIS] += FILAMENTCHANGE_FIRSTFEED; target[E_AXIS] += FILAMENTCHANGE_FIRSTFEED;
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EFEED, active_extruder); plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EFEED, active_extruder);
#endif // SNMM //Extrude some filament
//Extrude some filament
target[E_AXIS]+= FILAMENTCHANGE_FINALFEED ; target[E_AXIS]+= FILAMENTCHANGE_FINALFEED ;
plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EXFEED, active_extruder); plan_buffer_line(target[X_AXIS], target[Y_AXIS], target[Z_AXIS], target[E_AXIS], FILAMENTCHANGE_EXFEED, active_extruder);
#endif // SNMM
//Wait for user to check the state //Wait for user to check the state
lcd_change_fil_state = 0; lcd_change_fil_state = 0;
@ -6678,7 +6741,8 @@ Sigma_Exit:
custom_message_type = 0; custom_message_type = 0;
#ifdef PAT9125 #ifdef PAT9125
fsensor_enabled = old_fsensor_enabled; //temporary solution for unexpected restarting /*
// fsensor_enabled = old_fsensor_enabled; //temporary solution for unexpected restarting
if (fsensor_M600) if (fsensor_M600)
{ {
@ -6690,10 +6754,11 @@ Sigma_Exit:
cmdqueue_pop_front(); cmdqueue_pop_front();
} }
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
fsensor_enable(); // fsensor_enable();
fsensor_restore_print_and_continue(); fsensor_restore_print_and_continue();
} }
fsensor_M600 = false;
*/
#endif //PAT9125 #endif //PAT9125
} }
@ -6896,6 +6961,7 @@ Sigma_Exit:
case 914: // M914 Set normal mode case 914: // M914 Set normal mode
{ {
tmc2130_mode = TMC2130_MODE_NORMAL; tmc2130_mode = TMC2130_MODE_NORMAL;
update_mode_profile();
tmc2130_init(); tmc2130_init();
} }
break; break;
@ -6903,6 +6969,7 @@ Sigma_Exit:
case 915: // M915 Set silent mode case 915: // M915 Set silent mode
{ {
tmc2130_mode = TMC2130_MODE_SILENT; tmc2130_mode = TMC2130_MODE_SILENT;
update_mode_profile();
tmc2130_init(); tmc2130_init();
} }
break; break;
@ -6994,12 +7061,20 @@ Sigma_Exit:
break; break;
case 701: //M701: load filament case 701: //M701: load filament
{ {
#ifdef SNMM_V2
if (code_seen('E'))
{
snmm_extruder = code_value();
}
#endif
gcode_M701(); gcode_M701();
} }
break; break;
case 702: case 702:
{ {
#ifdef SNMM #if defined (SNMM) || defined (SNMM_V2)
if (code_seen('U')) { if (code_seen('U')) {
extr_unload_used(); //unload all filaments which were used in current print extr_unload_used(); //unload all filaments which were used in current print
} }
@ -7007,12 +7082,12 @@ Sigma_Exit:
extr_unload(); //unload just current filament extr_unload(); //unload just current filament
} }
else { else {
extr_unload_all(); //unload all filaments extr_unload_all(); //unload all filaments
} }
#else #else
#ifdef PAT9125 #ifdef PAT9125
bool old_fsensor_enabled = fsensor_enabled; bool old_fsensor_enabled = fsensor_enabled;
fsensor_enabled = false; // fsensor_enabled = false;
#endif //PAT9125 #endif //PAT9125
custom_message = true; custom_message = true;
custom_message_type = 2; custom_message_type = 2;
@ -7038,7 +7113,11 @@ Sigma_Exit:
disable_e2(); disable_e2();
delay(100); delay(100);
//-//
//if(eSoundMode==e_SOUND_MODE_LOUD)
// Sound_MakeSound_tmp();
Sound_MakeSound(e_SOUND_CLASS_Prompt,e_SOUND_TYPE_StandardPrompt);
/*
WRITE(BEEPER, HIGH); WRITE(BEEPER, HIGH);
uint8_t counterBeep = 0; uint8_t counterBeep = 0;
while (!lcd_clicked() && (counterBeep < 50)) { while (!lcd_clicked() && (counterBeep < 50)) {
@ -7047,6 +7126,13 @@ Sigma_Exit:
counterBeep++; counterBeep++;
} }
WRITE(BEEPER, LOW); WRITE(BEEPER, LOW);
*/
uint8_t counterBeep = 0;
while (!lcd_clicked() && (counterBeep < 50)) {
delay_keep_alive(100);
counterBeep++;
}
//-//
st_synchronize(); st_synchronize();
while (lcd_clicked()) delay_keep_alive(100); while (lcd_clicked()) delay_keep_alive(100);
@ -7056,7 +7142,7 @@ Sigma_Exit:
custom_message = false; custom_message = false;
custom_message_type = 0; custom_message_type = 0;
#ifdef PAT9125 #ifdef PAT9125
fsensor_enabled = old_fsensor_enabled; // fsensor_enabled = old_fsensor_enabled;
#endif //PAT9125 #endif //PAT9125
#endif #endif
} }
@ -7118,16 +7204,15 @@ Sigma_Exit:
break; break;
} }
bool response = mmu_get_reponse();
if (!response) mmu_not_responding();
snmm_extruder = tmp_extruder; //filament change is finished
// get response
uart2_rx_clr(); if (*(strchr_pointer + index) == '?') { // for single material usage with mmu
while (!uart2_rx_ok()) mmu_load_to_nozzle();
{
//printf_P(PSTR("waiting..\n")); }
delay_keep_alive(100);
}
#endif #endif
#ifdef SNMM #ifdef SNMM
@ -7611,7 +7696,7 @@ static void handleSafetyTimer()
void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument set in Marlin.h
{ {
#ifdef PAT9125 #ifdef PAT9125
if (fsensor_enabled && filament_autoload_enabled && !fsensor_M600 && !moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL)) if (fsensor_enabled && filament_autoload_enabled && fsensor_watch_runout && !moves_planned() && !IS_SD_PRINTING && !is_usb_printing && (lcd_commands_type != LCD_COMMAND_V2_CAL))
{ {
if (fsensor_autoload_enabled) if (fsensor_autoload_enabled)
{ {
@ -8448,8 +8533,6 @@ void uvlo_()
{ {
unsigned long time_start = millis(); unsigned long time_start = millis();
bool sd_print = card.sdprinting; bool sd_print = card.sdprinting;
//-//
MYSERIAL.println(">>> uvlo()");
// Conserve power as soon as possible. // Conserve power as soon as possible.
disable_x(); disable_x();
disable_y(); disable_y();
@ -8606,51 +8689,6 @@ MYSERIAL.println(">>> uvlo()");
}; };
} }
void uvlo_tiny()
{
uint16_t z_microsteps=0;
bool sd_print=card.sdprinting;
MYSERIAL.println(">>> uvloTiny()");
// Conserve power as soon as possible.
disable_x();
disable_y();
disable_e0();
#ifdef TMC2130
tmc2130_set_current_h(Z_AXIS, 20);
tmc2130_set_current_r(Z_AXIS, 20);
#endif //TMC2130
// Read out the current Z motor microstep counter
#ifdef TMC2130
z_microsteps=tmc2130_rd_MSCNT(Z_TMC2130_CS);
#endif //TMC2130
planner_abort_hard();
sei();
plan_buffer_line(
current_position[X_AXIS],
current_position[Y_AXIS],
current_position[Z_AXIS]+UVLO_Z_AXIS_SHIFT+float((1024-z_microsteps+7)>>4)/axis_steps_per_unit[Z_AXIS],
current_position[E_AXIS],
40, active_extruder);
st_synchronize();
disable_z();
// Finaly store the "power outage" flag.
//if(sd_print)
eeprom_update_byte((uint8_t*)EEPROM_UVLO,2);
eeprom_update_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS),z_microsteps);
eeprom_update_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z), current_position[Z_AXIS]);
// Increment power failure counter
eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, eeprom_read_byte((uint8_t*)EEPROM_POWER_COUNT) + 1);
eeprom_update_word((uint16_t*)EEPROM_POWER_COUNT_TOT, eeprom_read_word((uint16_t*)EEPROM_POWER_COUNT_TOT) + 1);
}
#endif //UVLO_SUPPORT #endif //UVLO_SUPPORT
#if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1)) #if (defined(FANCHECK) && defined(TACH_1) && (TACH_1 >-1))
@ -8703,20 +8741,7 @@ void setup_uvlo_interrupt() {
ISR(INT4_vect) { ISR(INT4_vect) {
EIMSK &= ~(1 << 4); //disable INT4 interrupt to make sure that this code will be executed just once EIMSK &= ~(1 << 4); //disable INT4 interrupt to make sure that this code will be executed just once
SERIAL_ECHOLNPGM("INT4"); SERIAL_ECHOLNPGM("INT4");
//-// if (IS_SD_PRINTING) uvlo_();
// if (IS_SD_PRINTING) uvlo_();
//if(IS_SD_PRINTING && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO))) ) uvlo_();
if(IS_SD_PRINTING && (!(eeprom_read_byte((uint8_t*)EEPROM_UVLO))) ) uvlo_();
if(eeprom_read_byte((uint8_t*)EEPROM_UVLO)) uvlo_tiny();
/*
if(IS_SD_PRINTING)
{
MYSERIAL.println(">>> ");
if(!(eeprom_read_byte((uint8_t*)EEPROM_UVLO)))
uvlo_();
else uvlo_tiny();
}
*/
} }
void recover_print(uint8_t automatic) { void recover_print(uint8_t automatic) {
@ -8725,17 +8750,10 @@ void recover_print(uint8_t automatic) {
lcd_update(2); lcd_update(2);
lcd_setstatuspgm(_i("Recovering print "));////MSG_RECOVERING_PRINT c=20 r=1 lcd_setstatuspgm(_i("Recovering print "));////MSG_RECOVERING_PRINT c=20 r=1
//-// recover_machine_state_after_power_panic(); //recover position, temperatures and extrude_multipliers
// recover_machine_state_after_power_panic(); //recover position, temperatures and extrude_multipliers
MYSERIAL.println(">>> RecoverPrint");
MYSERIAL.println(eeprom_read_byte((uint8_t*)EEPROM_UVLO),DEC);
bool bTiny=(eeprom_read_byte((uint8_t*)EEPROM_UVLO)==2);
recover_machine_state_after_power_panic(bTiny); //recover position, temperatures and extrude_multipliers
// Lift the print head, so one may remove the excess priming material. // Lift the print head, so one may remove the excess priming material.
//-// if (current_position[Z_AXIS] < 25)
//if (current_position[Z_AXIS] < 25)
if(!bTiny&&(current_position[Z_AXIS]<25))
enquecommand_P(PSTR("G1 Z25 F800")); enquecommand_P(PSTR("G1 Z25 F800"));
// Home X and Y axes. Homing just X and Y shall not touch the babystep and the world2machine transformation status. // Home X and Y axes. Homing just X and Y shall not touch the babystep and the world2machine transformation status.
enquecommand_P(PSTR("G28 X Y")); enquecommand_P(PSTR("G28 X Y"));
@ -8753,10 +8771,7 @@ if(!bTiny&&(current_position[Z_AXIS]<25))
enquecommand_P(PSTR("G1 E" STRINGIFY(-DEFAULT_RETRACTION)" F480")); enquecommand_P(PSTR("G1 E" STRINGIFY(-DEFAULT_RETRACTION)" F480"));
// Mark the power panic status as inactive. // Mark the power panic status as inactive.
//-// eeprom_update_byte((uint8_t*)EEPROM_UVLO, 0);
MYSERIAL.println("===== before");
// eeprom_update_byte((uint8_t*)EEPROM_UVLO, 0);
MYSERIAL.println("===== after");
/*while ((abs(degHotend(0)- target_temperature[0])>5) || (abs(degBed() -target_temperature_bed)>3)) { //wait for heater and bed to reach target temp /*while ((abs(degHotend(0)- target_temperature[0])>5) || (abs(degBed() -target_temperature_bed)>3)) { //wait for heater and bed to reach target temp
delay_keep_alive(1000); delay_keep_alive(1000);
}*/ }*/
@ -8767,10 +8782,9 @@ MYSERIAL.println("===== after");
restore_print_from_eeprom(); restore_print_from_eeprom();
printf_P(_N("Current pos Z_AXIS:%.3f\nCurrent pos E_AXIS:%.3f\n"), current_position[Z_AXIS], current_position[E_AXIS]); printf_P(_N("Current pos Z_AXIS:%.3f\nCurrent pos E_AXIS:%.3f\n"), current_position[Z_AXIS], current_position[E_AXIS]);
MYSERIAL.println("===== konec");
} }
void recover_machine_state_after_power_panic(bool bTiny) void recover_machine_state_after_power_panic()
{ {
char cmd[30]; char cmd[30];
// 1) Recover the logical cordinates at the time of the power panic. // 1) Recover the logical cordinates at the time of the power panic.
@ -8779,16 +8793,8 @@ void recover_machine_state_after_power_panic(bool bTiny)
current_position[Y_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4)); current_position[Y_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION + 4));
// Recover the logical coordinate of the Z axis at the time of the power panic. // Recover the logical coordinate of the Z axis at the time of the power panic.
// The current position after power panic is moved to the next closest 0th full step. // The current position after power panic is moved to the next closest 0th full step.
//-// current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) +
// current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) +
// UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / axis_steps_per_unit[Z_AXIS];
if(bTiny)
current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_TINY_CURRENT_POSITION_Z)) +
UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_TINY_Z_MICROSTEPS)) + 7) >> 4) / axis_steps_per_unit[Z_AXIS];
else
current_position[Z_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_Z)) +
UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / axis_steps_per_unit[Z_AXIS]; UVLO_Z_AXIS_SHIFT + float((1024 - eeprom_read_word((uint16_t*)(EEPROM_UVLO_Z_MICROSTEPS)) + 7) >> 4) / axis_steps_per_unit[Z_AXIS];
//-//
if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS)) { if (eeprom_read_byte((uint8_t*)EEPROM_UVLO_E_ABS)) {
current_position[E_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E)); current_position[E_AXIS] = eeprom_read_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E));
sprintf_P(cmd, PSTR("G92 E")); sprintf_P(cmd, PSTR("G92 E"));
@ -8921,8 +8927,6 @@ void restore_print_from_eeprom() {
// Set a position in the file. // Set a position in the file.
sprintf_P(cmd, PSTR("M26 S%lu"), position); sprintf_P(cmd, PSTR("M26 S%lu"), position);
enquecommand(cmd); enquecommand(cmd);
//-//
enquecommand_P(PSTR("G4 S0"));
// Start SD print. // Start SD print.
enquecommand_P(PSTR("M24")); enquecommand_P(PSTR("M24"));
} }
@ -9201,4 +9205,39 @@ static void print_time_remaining_init() {
print_percent_done_silent = PRINT_PERCENT_DONE_INIT; print_percent_done_silent = PRINT_PERCENT_DONE_INIT;
} }
bool mmu_get_reponse() {
bool response = true;
LongTimer mmu_get_reponse_timeout;
uart2_rx_clr();
mmu_get_reponse_timeout.start();
while (!uart2_rx_ok())
{
delay_keep_alive(100);
if (mmu_get_reponse_timeout.expired(30 * 1000ul)) { //PINDA cooling from 60 C to 35 C takes about 7 minutes
response = false;
break;
}
}
return response;
}
void mmu_not_responding() {
printf_P(PSTR("MMU not responding"));
}
void mmu_load_to_nozzle() {
bool saved_e_relative_mode = axis_relative_modes[E_AXIS];
if (!saved_e_relative_mode) {
enquecommand_front_P(PSTR("M82")); // set extruder to relative mode
}
enquecommand_front_P((PSTR("G1 E7.2000 F562")));
enquecommand_front_P((PSTR("G1 E14.4000 F871")));
enquecommand_front_P((PSTR("G1 E36.0000 F1393")));
enquecommand_front_P((PSTR("G1 E14.4000 F871")));
if (!saved_e_relative_mode) {
enquecommand_front_P(PSTR("M83")); // set extruder to relative mode
}
}
#define FIL_LOAD_LENGTH 60 #define FIL_LOAD_LENGTH 60

182
Firmware/eeprom.h Normal file
View File

@ -0,0 +1,182 @@
#ifndef EEPROM_H
#define EEPROM_H
// The total size of the EEPROM is
// 4096 for the Atmega2560
#define EEPROM_TOP 4096
#define EEPROM_SILENT 4095
#define EEPROM_LANG 4094
#define EEPROM_BABYSTEP_X 4092
#define EEPROM_BABYSTEP_Y 4090
#define EEPROM_BABYSTEP_Z 4088
#define EEPROM_CALIBRATION_STATUS 4087
#define EEPROM_BABYSTEP_Z0 4085
#define EEPROM_FILAMENTUSED 4081
// uint32_t
#define EEPROM_TOTALTIME 4077
#define EEPROM_BED_CALIBRATION_CENTER (EEPROM_TOTALTIME-2*4)
#define EEPROM_BED_CALIBRATION_VEC_X (EEPROM_BED_CALIBRATION_CENTER-2*4)
#define EEPROM_BED_CALIBRATION_VEC_Y (EEPROM_BED_CALIBRATION_VEC_X-2*4)
// Offsets of the Z heiths of the calibration points from the first point.
// The offsets are saved as 16bit signed int, scaled to tenths of microns.
#define EEPROM_BED_CALIBRATION_Z_JITTER (EEPROM_BED_CALIBRATION_VEC_Y-2*8)
#define EEPROM_FARM_MODE (EEPROM_BED_CALIBRATION_Z_JITTER-1)
#define EEPROM_FARM_NUMBER (EEPROM_FARM_MODE-3)
// Correction of the bed leveling, in micrometers.
// Maximum 50 micrometers allowed.
// Bed correction is valid if set to 1. If set to zero or 255, the successive 4 bytes are invalid.
#define EEPROM_BED_CORRECTION_VALID (EEPROM_FARM_NUMBER-1)
#define EEPROM_BED_CORRECTION_LEFT (EEPROM_BED_CORRECTION_VALID-1)
#define EEPROM_BED_CORRECTION_RIGHT (EEPROM_BED_CORRECTION_LEFT-1)
#define EEPROM_BED_CORRECTION_FRONT (EEPROM_BED_CORRECTION_RIGHT-1)
#define EEPROM_BED_CORRECTION_REAR (EEPROM_BED_CORRECTION_FRONT-1)
#define EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY (EEPROM_BED_CORRECTION_REAR-1)
#define EEPROM_PRINT_FLAG (EEPROM_TOSHIBA_FLASH_AIR_COMPATIBLITY-1)
#define EEPROM_PROBE_TEMP_SHIFT (EEPROM_PRINT_FLAG - 2*5) //5 x int for storing pinda probe temp shift relative to 50 C; unit: motor steps
#define EEPROM_TEMP_CAL_ACTIVE (EEPROM_PROBE_TEMP_SHIFT - 1)
#define EEPROM_BOWDEN_LENGTH (EEPROM_TEMP_CAL_ACTIVE - 2*4) //4 x int for bowden lengths for multimaterial
#define EEPROM_CALIBRATION_STATUS_PINDA (EEPROM_BOWDEN_LENGTH - 1) //0 - not calibrated; 1 - calibrated
#define EEPROM_UVLO (EEPROM_CALIBRATION_STATUS_PINDA - 1) //1 - uvlo during print
#define EEPROM_UVLO_CURRENT_POSITION (EEPROM_UVLO-2*4) // 2 x float for current_position in X and Y axes
#define EEPROM_FILENAME (EEPROM_UVLO_CURRENT_POSITION - 8) //8chars to store filename without extension
#define EEPROM_FILE_POSITION (EEPROM_FILENAME - 4) //32 bit for uint32_t file position
#define EEPROM_UVLO_CURRENT_POSITION_Z (EEPROM_FILE_POSITION - 4) //float for current position in Z
#define EEPROM_UVLO_TARGET_HOTEND (EEPROM_UVLO_CURRENT_POSITION_Z - 1)
#define EEPROM_UVLO_TARGET_BED (EEPROM_UVLO_TARGET_HOTEND - 1)
#define EEPROM_UVLO_FEEDRATE (EEPROM_UVLO_TARGET_BED - 2)
#define EEPROM_UVLO_FAN_SPEED (EEPROM_UVLO_FEEDRATE - 1)
#define EEPROM_FAN_CHECK_ENABLED (EEPROM_UVLO_FAN_SPEED - 1)
#define EEPROM_UVLO_MESH_BED_LEVELING (EEPROM_FAN_CHECK_ENABLED - 9*2)
#define EEPROM_UVLO_Z_MICROSTEPS (EEPROM_UVLO_MESH_BED_LEVELING - 2)
#define EEPROM_UVLO_E_ABS (EEPROM_UVLO_Z_MICROSTEPS - 1)
#define EEPROM_UVLO_CURRENT_POSITION_E (EEPROM_UVLO_E_ABS - 4) //float for current position in E
// Crash detection mode EEPROM setting
#define EEPROM_CRASH_DET (EEPROM_UVLO_CURRENT_POSITION_E - 5) // float (orig EEPROM_UVLO_MESH_BED_LEVELING-12)
// Crash detection counter Y (last print)
#define EEPROM_CRASH_COUNT_Y (EEPROM_CRASH_DET - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-15)
// Filament sensor on/off EEPROM setting
#define EEPROM_FSENSOR (EEPROM_CRASH_COUNT_Y - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-14)
// Crash detection counter X (last print)
#define EEPROM_CRASH_COUNT_X (EEPROM_FSENSOR - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-15)
// Filament runout/error coutner (last print)
#define EEPROM_FERROR_COUNT (EEPROM_CRASH_COUNT_X - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-16)
// Power loss errors (last print)
#define EEPROM_POWER_COUNT (EEPROM_FERROR_COUNT - 1) // uint8 (orig EEPROM_UVLO_MESH_BED_LEVELING-17)
#define EEPROM_XYZ_CAL_SKEW (EEPROM_POWER_COUNT - 4) // float for skew backup
#define EEPROM_WIZARD_ACTIVE (EEPROM_XYZ_CAL_SKEW - 1)
#define EEPROM_BELTSTATUS_X (EEPROM_WIZARD_ACTIVE - 2) // uint16
#define EEPROM_BELTSTATUS_Y (EEPROM_BELTSTATUS_X - 2) // uint16
#define EEPROM_DIR_DEPTH (EEPROM_BELTSTATUS_Y-1)
#define EEPROM_DIRS (EEPROM_DIR_DEPTH-80) //8 chars for each dir name, max 10 levels
#define EEPROM_SD_SORT (EEPROM_DIRS - 1) //0 -time, 1-alpha, 2-none
#define EEPROM_SECOND_SERIAL_ACTIVE (EEPROM_SD_SORT - 1)
#define EEPROM_FSENS_AUTOLOAD_ENABLED (EEPROM_SECOND_SERIAL_ACTIVE - 1)
// Crash detection counter X (total)
#define EEPROM_CRASH_COUNT_X_TOT (EEPROM_FSENS_AUTOLOAD_ENABLED - 2) // uint16
// Crash detection counter Y (total)
#define EEPROM_CRASH_COUNT_Y_TOT (EEPROM_CRASH_COUNT_X_TOT - 2) // uint16
// Filament runout/error coutner (total)
#define EEPROM_FERROR_COUNT_TOT (EEPROM_CRASH_COUNT_Y_TOT - 2) // uint16
// Power loss errors (total)
#define EEPROM_POWER_COUNT_TOT (EEPROM_FERROR_COUNT_TOT - 2) // uint16
////////////////////////////////////////
// TMC2130 Accurate sensorless homing
// X-axis home origin (stepper phase in microsteps, 0..63 for 16ustep resolution)
#define EEPROM_TMC2130_HOME_X_ORIGIN (EEPROM_POWER_COUNT_TOT - 1) // uint8
// X-axis home bsteps (number of microsteps backward)
#define EEPROM_TMC2130_HOME_X_BSTEPS (EEPROM_TMC2130_HOME_X_ORIGIN - 1) // uint8
// X-axis home fsteps (number of microsteps forward)
#define EEPROM_TMC2130_HOME_X_FSTEPS (EEPROM_TMC2130_HOME_X_BSTEPS - 1) // uint8
// Y-axis home origin (stepper phase in microsteps, 0..63 for 16ustep resolution)
#define EEPROM_TMC2130_HOME_Y_ORIGIN (EEPROM_TMC2130_HOME_X_FSTEPS - 1) // uint8
// X-axis home bsteps (number of microsteps backward)
#define EEPROM_TMC2130_HOME_Y_BSTEPS (EEPROM_TMC2130_HOME_Y_ORIGIN - 1) // uint8
// X-axis home fsteps (number of microsteps forward)
#define EEPROM_TMC2130_HOME_Y_FSTEPS (EEPROM_TMC2130_HOME_Y_BSTEPS - 1) // uint8
// Accurate homing enabled
#define EEPROM_TMC2130_HOME_ENABLED (EEPROM_TMC2130_HOME_Y_FSTEPS - 1) // uint8
////////////////////////////////////////
// TMC2130 uStep linearity correction
// Linearity correction factor (XYZE)
#define EEPROM_TMC2130_WAVE_X_FAC (EEPROM_TMC2130_HOME_ENABLED - 1) // uint8
#define EEPROM_TMC2130_WAVE_Y_FAC (EEPROM_TMC2130_WAVE_X_FAC - 1) // uint8
#define EEPROM_TMC2130_WAVE_Z_FAC (EEPROM_TMC2130_WAVE_Y_FAC - 1) // uint8
#define EEPROM_TMC2130_WAVE_E_FAC (EEPROM_TMC2130_WAVE_Z_FAC - 1) // uint8
////////////////////////////////////////
// TMC2130 uStep resolution
// microstep resolution (XYZE): usteps = (256 >> mres)
#define EEPROM_TMC2130_X_MRES (EEPROM_TMC2130_WAVE_E_FAC - 1) // uint8
#define EEPROM_TMC2130_Y_MRES (EEPROM_TMC2130_X_MRES - 1) // uint8
#define EEPROM_TMC2130_Z_MRES (EEPROM_TMC2130_Y_MRES - 1) // uint8
#define EEPROM_TMC2130_E_MRES (EEPROM_TMC2130_Z_MRES - 1) // uint8
// HW
#define EEPROM_PRINTER_TYPE (EEPROM_TMC2130_E_MRES - 2) // uint16
#define EEPROM_BOARD_TYPE (EEPROM_PRINTER_TYPE - 2) // uint16
// Extruder multiplier for power panic
#define EEPROM_EXTRUDER_MULTIPLIER_0 (EEPROM_BOARD_TYPE - 4) //float
#define EEPROM_EXTRUDER_MULTIPLIER_1 (EEPROM_EXTRUDER_MULTIPLIER_0 - 4) //float
#define EEPROM_EXTRUDER_MULTIPLIER_2 (EEPROM_EXTRUDER_MULTIPLIER_1 - 4) //float
#define EEPROM_EXTRUDEMULTIPLY (EEPROM_EXTRUDER_MULTIPLIER_2 - 2) // uint16
// Sound Mode
#define EEPROM_SOUND_MODE (EEPROM_EXTRUDEMULTIPLY-1) // uint8
// !!!!!
// !!!!! this is end of EEPROM section ... all updates MUST BE inserted before this mark !!!!!
// !!!!!
//TMC2130 configuration
#define EEPROM_TMC_AXIS_SIZE //axis configuration block size
#define EEPROM_TMC_X (EEPROM_TMC + 0 * EEPROM_TMC_AXIS_SIZE) //X axis configuration blok
#define EEPROM_TMC_Y (EEPROM_TMC + 1 * EEPROM_TMC_AXIS_SIZE) //Y axis
#define EEPROM_TMC_Z (EEPROM_TMC + 2 * EEPROM_TMC_AXIS_SIZE) //Z axis
#define EEPROM_TMC_E (EEPROM_TMC + 3 * EEPROM_TMC_AXIS_SIZE) //E axis
//TMC2130 - X axis
#define EEPROM_TMC_X_USTEPS_INTPOL (EEPROM_TMC_X + 0) // 1byte, bit 0..4 USTEPS, bit 7 INTPOL
#define EEPROM_TMC_X_PWM_AMPL (EEPROM_TMC_X + 1) // 1byte (0..255)
#define EEPROM_TMC_X_PWM_GRAD_FREQ (EEPROM_TMC_X + 2) // 1byte, bit 0..3 GRAD, bit 4..5 FREQ
#define EEPROM_TMC_X_TCOOLTHRS (EEPROM_TMC_X + 3) // 2bytes (0..)
#define EEPROM_TMC_X_SG_THRS (EEPROM_TMC_X + 5) // 1byte, (-64..+63)
#define EEPROM_TMC_X_CURRENT_H (EEPROM_TMC_X + 6) // 1byte, (0..63)
#define EEPROM_TMC_X_CURRENT_R (EEPROM_TMC_X + 7) // 1byte, (0..63)
#define EEPROM_TMC_X_HOME_SG_THRS (EEPROM_TMC_X + 8) // 1byte, (-64..+63)
#define EEPROM_TMC_X_HOME_CURRENT_R (EEPROM_TMC_X + 9) // 1byte, (-64..+63)
#define EEPROM_TMC_X_HOME_DTCOOLTHRS (EEPROM_TMC_X + 10) // 1byte (-128..+127)
#define EEPROM_TMC_X_DTCOOLTHRS_LOW (EEPROM_TMC_X + 11) // 1byte (-128..+127)
#define EEPROM_TMC_X_DTCOOLTHRS_HIGH (EEPROM_TMC_X + 12) // 1byte (-128..+127)
#define EEPROM_TMC_X_SG_THRS_LOW (EEPROM_TMC_X + 13) // 1byte, (-64..+63)
#define EEPROM_TMC_X_SG_THRS_HIGH (EEPROM_TMC_X + 14) // 1byte, (-64..+63)
// Currently running firmware, each digit stored as uint16_t.
// The flavor differentiates a dev, alpha, beta, release candidate or a release version.
#define EEPROM_FIRMWARE_VERSION_END (FW_PRUSA3D_MAGIC_LEN+8)
#define EEPROM_FIRMWARE_VERSION_FLAVOR (FW_PRUSA3D_MAGIC_LEN+6)
#define EEPROM_FIRMWARE_VERSION_REVISION (FW_PRUSA3D_MAGIC_LEN+4)
#define EEPROM_FIRMWARE_VERSION_MINOR (FW_PRUSA3D_MAGIC_LEN+2)
#define EEPROM_FIRMWARE_VERSION_MAJOR FW_PRUSA3D_MAGIC_LEN
// Magic string, indicating that the current or the previous firmware running was the Prusa3D firmware.
#define EEPROM_FIRMWARE_PRUSA_MAGIC 0
#define EEPROM_OFFSET 20 //offset for storing settings using M500
//#define EEPROM_OFFSET
#endif // EEPROM_H

View File

@ -13,6 +13,8 @@
//#include <Arduino.h> //#include <Arduino.h>
#include "Marlin.h" #include "Marlin.h"
#include "fastio.h" #include "fastio.h"
//-//
#include "sound.h"
// commands // commands
@ -689,6 +691,9 @@ uint8_t lcd_clicked(void)
void lcd_beeper_quick_feedback(void) void lcd_beeper_quick_feedback(void)
{ {
SET_OUTPUT(BEEPER); SET_OUTPUT(BEEPER);
//-//
Sound_MakeSound(e_SOUND_CLASS_Echo,e_SOUND_TYPE_ButtonEcho);
/*
for(int8_t i = 0; i < 10; i++) for(int8_t i = 0; i < 10; i++)
{ {
WRITE(BEEPER,HIGH); WRITE(BEEPER,HIGH);
@ -696,6 +701,7 @@ void lcd_beeper_quick_feedback(void)
WRITE(BEEPER,LOW); WRITE(BEEPER,LOW);
delayMicroseconds(100); delayMicroseconds(100);
} }
*/
} }
void lcd_quick_feedback(void) void lcd_quick_feedback(void)

105
Firmware/sound.cpp Normal file
View File

@ -0,0 +1,105 @@
#include "sound.h"
#include "Marlin.h"
//#include <inttypes.h>
//#include <avr/eeprom.h>
//#include "eeprom.h"
//eSOUND_MODE eSoundMode=e_SOUND_MODE_LOUD;
// nema vyznam, pokud se bude volat Sound_Init (tzn. poc. hodnota je v EEPROM)
// !?! eSOUND_MODE eSoundMode; v ultraldc.cpp :: cd_settings_menu() se takto jevi jako lokalni promenna
eSOUND_MODE eSoundMode; //=e_SOUND_MODE_DEFAULT;
static void Sound_SaveMode(void);
static void Sound_DoSound_Echo(void);
static void Sound_DoSound_Prompt(void);
void Sound_Init(void)
{
eSoundMode=(eSOUND_MODE)eeprom_read_byte((uint8_t*)EEPROM_SOUND_MODE);
if(eSoundMode==e_SOUND_MODE_NULL)
Sound_Default(); // je potreba provest i ulozeni do EEPROM
}
void Sound_Default(void)
{
eSoundMode=e_SOUND_MODE_DEFAULT;
Sound_SaveMode();
}
void Sound_SaveMode(void)
{
eeprom_update_byte((uint8_t*)EEPROM_SOUND_MODE,(uint8_t)eSoundMode);
}
void Sound_CycleState(void)
{
switch(eSoundMode)
{
case e_SOUND_MODE_LOUD:
eSoundMode=e_SOUND_MODE_ONCE;
break;
case e_SOUND_MODE_ONCE:
eSoundMode=e_SOUND_MODE_SILENT;
break;
case e_SOUND_MODE_SILENT:
eSoundMode=e_SOUND_MODE_MUTE;
break;
case e_SOUND_MODE_MUTE:
eSoundMode=e_SOUND_MODE_LOUD;
break;
default:
eSoundMode=e_SOUND_MODE_LOUD;
}
Sound_SaveMode();
}
void Sound_MakeSound(eSOUND_CLASS eSoundClass,eSOUND_TYPE eSoundType)
{
switch(eSoundMode)
{
case e_SOUND_MODE_LOUD:
if(eSoundType==e_SOUND_TYPE_ButtonEcho)
Sound_DoSound_Echo();
if(eSoundType==e_SOUND_TYPE_StandardPrompt)
Sound_DoSound_Prompt();
break;
case e_SOUND_MODE_ONCE:
if(eSoundType==e_SOUND_TYPE_ButtonEcho)
Sound_DoSound_Echo();
if(eSoundType==e_SOUND_TYPE_StandardPrompt)
Sound_DoSound_Prompt();
break;
case e_SOUND_MODE_SILENT:
break;
case e_SOUND_MODE_MUTE:
break;
default:
;
}
}
static void Sound_DoSound_Echo(void)
{
uint8_t nI;
for(nI=0;nI<10;nI++)
{
WRITE(BEEPER,HIGH);
delayMicroseconds(100);
WRITE(BEEPER,LOW);
delayMicroseconds(100);
}
}
static void Sound_DoSound_Prompt(void)
{
WRITE(BEEPER,HIGH);
delay_keep_alive(500);
WRITE(BEEPER,LOW);
}

34
Firmware/sound.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef SOUND_H
#define SOUND_H
#define MSG_SOUND_MODE_LOUD "Sound [loud]"
#define MSG_SOUND_MODE_ONCE "Sound [once]"
#define MSG_SOUND_MODE_SILENT "Sound [silent]"
#define MSG_SOUND_MODE_MUTE "Sound [mute]"
#define e_SOUND_MODE_NULL 0xFF
typedef enum
{e_SOUND_MODE_LOUD,e_SOUND_MODE_ONCE,e_SOUND_MODE_SILENT,e_SOUND_MODE_MUTE} eSOUND_MODE;
#define e_SOUND_MODE_DEFAULT e_SOUND_MODE_LOUD
typedef enum
{e_SOUND_TYPE_ButtonEcho,e_SOUND_TYPE_EncoderEcho,e_SOUND_TYPE_StandardPrompt,e_SOUND_TYPE_StandardConfirm,e_SOUND_TYPE_StandardWarning,e_SOUND_TYPE_StandardAlert} eSOUND_TYPE;
typedef enum
{e_SOUND_CLASS_Echo,e_SOUND_CLASS_Prompt,e_SOUND_CLASS_Confirm,e_SOUND_CLASS_Warning,e_SOUND_CLASS_Alert} eSOUND_CLASS;
extern eSOUND_MODE eSoundMode;
extern void Sound_Init(void);
extern void Sound_Default(void);
extern void Sound_Save(void);
extern void Sound_CycleState(void);
extern void Sound_MakeSound(eSOUND_CLASS eSoundClass,eSOUND_TYPE eSoundType);
//static void Sound_DoSound_Echo(void);
//static void Sound_DoSound_Prompt(void);
#endif // SOUND_H

View File

@ -31,6 +31,9 @@
#include "tmc2130.h" #include "tmc2130.h"
#endif //TMC2130 #endif //TMC2130
//-//
#include "sound.h"
#ifdef SNMM_V2 #ifdef SNMM_V2
#include "uart2.h" #include "uart2.h"
#endif //SNMM_V2 #endif //SNMM_V2
@ -4112,6 +4115,11 @@ static void lcd_fsensor_state_set()
} }
#endif //PAT9125 #endif //PAT9125
//-//
static void lcd_sound_state_set(void)
{
Sound_CycleState();
}
#if !SDSORT_USES_RAM #if !SDSORT_USES_RAM
void lcd_set_degree() { void lcd_set_degree() {
@ -4668,7 +4676,7 @@ static void lcd_settings_menu()
#endif //(LANG_MODE != 0) #endif //(LANG_MODE != 0)
if (card.ToshibaFlashAir_isEnabled()) { if (card.ToshibaFlashAir_isEnabled()) {
MENU_ITEM_FUNCTION_P(_i("SD card [FlshAir]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON c=19 r=1 MENU_ITEM_FUNCTION_P(_i("SD card [flshAir]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON c=19 r=1
} else { } else {
MENU_ITEM_FUNCTION_P(_i("SD card [normal]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF c=19 r=1 MENU_ITEM_FUNCTION_P(_i("SD card [normal]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF c=19 r=1
} }
@ -4678,13 +4686,33 @@ static void lcd_settings_menu()
uint8_t sdSort; uint8_t sdSort;
EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort)); EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));
switch (sdSort) { switch (sdSort) {
case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort: [Time]"), lcd_sort_type_set); break;////MSG_SORT_TIME c=17 r=1 case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort: [time]"), lcd_sort_type_set); break;////MSG_SORT_TIME c=17 r=1
case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort: [Alphabet]"), lcd_sort_type_set); break;////MSG_SORT_ALPHA c=17 r=1 case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort: [alphabet]"), lcd_sort_type_set); break;////MSG_SORT_ALPHA c=17 r=1
default: MENU_ITEM_FUNCTION_P(_i("Sort: [None]"), lcd_sort_type_set);////MSG_SORT_NONE c=17 r=1 default: MENU_ITEM_FUNCTION_P(_i("Sort: [none]"), lcd_sort_type_set);////MSG_SORT_NONE c=17 r=1
} }
} }
#endif // SDCARD_SORT_ALPHA #endif // SDCARD_SORT_ALPHA
//-//
switch(eSoundMode)
{
case e_SOUND_MODE_LOUD:
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set);
break;
case e_SOUND_MODE_ONCE:
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_ONCE),lcd_sound_state_set);
break;
case e_SOUND_MODE_SILENT:
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_SILENT),lcd_sound_state_set);
break;
case e_SOUND_MODE_MUTE:
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_MUTE),lcd_sound_state_set);
break;
default:
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set);
}
//-//
if (farm_mode) if (farm_mode)
{ {
MENU_ITEM_SUBMENU_P(PSTR("Farm number"), lcd_farm_no); MENU_ITEM_SUBMENU_P(PSTR("Farm number"), lcd_farm_no);