Skip to content

Commit

Permalink
Merge branch 'MK3' into MK3-private_build
Browse files Browse the repository at this point in the history
Fixed merging
  • Loading branch information
3d-gussner committed Feb 3, 2018
2 parents e3b4015 + 8375e2c commit 2dca6ef
Show file tree
Hide file tree
Showing 18 changed files with 280 additions and 135 deletions.
42 changes: 27 additions & 15 deletions Firmware/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#define STR(x) STR_HELPER(x)

// Firmware version
#define FW_VERSION "3.1.1-RC5"
#define FW_COMMIT_NR 151
#define FW_VERSION "3.1.1"
#define FW_COMMIT_NR 197
// FW_VERSION_UNKNOWN means this is an unofficial build.
// The firmware should only be checked into github with this symbol.
#define FW_DEV_VERSION FW_VERSION_UNKNOWN
Expand Down Expand Up @@ -93,25 +93,28 @@
#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
#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_MESH_BED_LEVELING-12)
#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_UVLO_MESH_BED_LEVELING-14)
// Crash detection counter
#define EEPROM_CRASH_COUNT (EEPROM_UVLO_MESH_BED_LEVELING-15)
// Filament runout/error coutner
#define EEPROM_FERROR_COUNT (EEPROM_UVLO_MESH_BED_LEVELING-16)
// Power loss errors
#define EEPROM_POWER_COUNT (EEPROM_UVLO_MESH_BED_LEVELING-17)

#define EEPROM_XYZ_CAL_SKEW (EEPROM_POWER_COUNT - 4) //float for skew backup
#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_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
Expand All @@ -126,6 +129,15 @@
#define EEPROM_BED_CORRECTION_REAR_RIGHT (EEPROM_BED_CORRECTION_FRONT_RIGHT - 1)
#define EEPROM_BED_CORRECTION_REAR_LEFT (EEPROM_BED_CORRECTION_REAR_RIGHT - 1)
// End Hyperfine Bed Tuning
// 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 configuration
#define EEPROM_TMC_AXIS_SIZE //axis configuration block size
Expand Down
13 changes: 11 additions & 2 deletions Firmware/ConfigurationStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void _EEPROM_readData(int &pos, uint8_t* value, uint8_t size)
// wrong data being written to the variables.
// ALSO: always make sure the variables in the Store and retrieve sections are in the same order.

#define EEPROM_VERSION "V1"
#define EEPROM_VERSION "V2"

#ifdef EEPROM_SETTINGS
void Config_StoreSettings(uint16_t offset, uint8_t level)
Expand Down Expand Up @@ -285,9 +285,10 @@ void Config_PrintSettings(uint8_t level)


#ifdef EEPROM_SETTINGS
void Config_RetrieveSettings(uint16_t offset, uint8_t level)
bool Config_RetrieveSettings(uint16_t offset, uint8_t level)
{
int i=offset;
bool previous_settings_retrieved = true;
char stored_ver[4];
char ver[4]=EEPROM_VERSION;
EEPROM_READ_VAR(i,stored_ver); //read stored version
Expand Down Expand Up @@ -386,10 +387,18 @@ void Config_RetrieveSettings(uint16_t offset, uint8_t level)
else
{
Config_ResetDefault();
//Return false to inform user that eeprom version was changed and firmware is using default hardcoded settings now.
//In case that storing to eeprom was not used yet, do not inform user that hardcoded settings are used.
if (eeprom_read_byte((uint8_t *)offset) != 0xFF ||
eeprom_read_byte((uint8_t *)offset + 1) != 0xFF ||
eeprom_read_byte((uint8_t *)offset + 2) != 0xFF) {
previous_settings_retrieved = false;
}
}
#ifdef EEPROM_CHITCHAT
Config_PrintSettings();
#endif
return previous_settings_retrieved;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion Firmware/ConfigurationStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FORCE_INLINE void Config_PrintSettings() {}

#ifdef EEPROM_SETTINGS
void Config_StoreSettings(uint16_t offset, uint8_t level = 0);
void Config_RetrieveSettings(uint16_t offset, uint8_t level = 0);
bool Config_RetrieveSettings(uint16_t offset, uint8_t level = 0);
#else
FORCE_INLINE void Config_StoreSettings() {}
FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
Expand Down
23 changes: 18 additions & 5 deletions Firmware/Configuration_prusa.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define MINTEMP_MINAMBIENT 25
#define MINTEMP_MINAMBIENT_RAW 978


//#define DEBUG_BUILD
#ifdef DEBUG_BUILD
//#define _NO_ASM
#define DEBUG_DCODES //D codes
Expand All @@ -119,7 +119,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
//#define DEBUG_DISABLE_YMAXLIMIT //y max limit ignored
//#define DEBUG_DISABLE_ZMINLIMIT //z min limit ignored
//#define DEBUG_DISABLE_ZMAXLIMIT //z max limit ignored
//#define DEBUG_DISABLE_STARTMSGS //no startup messages
#define DEBUG_DISABLE_STARTMSGS //no startup messages
//#define DEBUG_DISABLE_MINTEMP //mintemp error ignored
//#define DEBUG_DISABLE_SWLIMITS //sw limits ignored
//#define DEBUG_DISABLE_LCD_STATUS_LINE //empty four lcd line
Expand Down Expand Up @@ -159,16 +159,28 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
#define TMC2130_PWM_AUTO_Y 1 // PWMCONF
#define TMC2130_PWM_FREQ_Y 2 // PWMCONF

/* //not used
#define TMC2130_PWM_GRAD_E 2 // PWMCONF
#define TMC2130_PWM_AMPL_E 235 // PWMCONF
#define TMC2130_PWM_AUTO_E 1 // PWMCONF
#define TMC2130_PWM_FREQ_E 2 // PWMCONF

#define TMC2130_PWM_GRAD_Z 4 // PWMCONF
#define TMC2130_PWM_AMPL_Z 200 // PWMCONF
#define TMC2130_PWM_AUTO_Z 1 // PWMCONF
#define TMC2130_PWM_FREQ_Z 2 // PWMCONF

#define TMC2130_PWM_GRAD_E 4 // PWMCONF
#define TMC2130_PWM_AMPL_E 200 // PWMCONF
#define TMC2130_PWM_AMPL_E 240 // PWMCONF
#define TMC2130_PWM_AUTO_E 1 // PWMCONF
#define TMC2130_PWM_FREQ_E 2 // PWMCONF
*/

#define TMC2130_TOFF_XYZ 3 // CHOPCONF // fchop = 27.778kHz
#define TMC2130_TOFF_E 3 // CHOPCONF // fchop = 27.778kHz
//#define TMC2130_TOFF_E 4 // CHOPCONF // fchop = 21.429kHz
//#define TMC2130_TOFF_E 5 // CHOPCONF // fchop = 17.442kHz

//#define TMC2130_STEALTH_E // Extruder stealthChop mode
//#define TMC2130_CNSTOFF_E // Extruder constant-off-time mode (similar to MK2)

//#define TMC2130_PWM_DIV 683 // PWM frequency divider (1024, 683, 512, 410)
#define TMC2130_PWM_DIV 512 // PWM frequency divider (1024, 683, 512, 410)
Expand All @@ -193,6 +205,7 @@ const bool Z_MIN_ENDSTOP_INVERTING = false; // set to true to invert the logic o
//new settings is possible for vsense = 1, running current value > 31 set vsense to zero and shift both currents by 1 bit right (Z axis only)
#define TMC2130_CURRENTS_H {13, 20, 25, 35} // default holding currents for all axes
#define TMC2130_CURRENTS_R {13, 20, 25, 35} // default running currents for all axes
#define TMC2130_UNLOAD_CURRENT_R 12 // lowe current for M600 to protect filament sensor

//#define TMC2130_DEBUG
//#define TMC2130_DEBUG_WR
Expand Down
5 changes: 3 additions & 2 deletions Firmware/Dcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ void dcode_10()
void dcode_12()
{//Reset Filament error, Power loss and crash counter ( Do it before every print and you can get stats for the print )
LOG("D12 - Reset failstat counters\n");
eeprom_update_byte((uint8_t*)EEPROM_CRASH_COUNT, 0x00);
eeprom_update_byte((uint8_t*)EEPROM_CRASH_COUNT_X, 0x00);
eeprom_update_byte((uint8_t*)EEPROM_FERROR_COUNT, 0x00);
eeprom_update_byte((uint8_t*)EEPROM_POWER_COUNT, 0x00);
}
Expand Down Expand Up @@ -491,7 +491,8 @@ void dcode_9125()
LOG("D9125 - PAT9125\n");
if ((strchr_pointer[1+4] == '?') || (strchr_pointer[1+4] == 0))
{
printf("res_x=%d res_y=%d x=%d y=%d b=%d s=%d\n", pat9125_xres, pat9125_yres, pat9125_x, pat9125_y, pat9125_b, pat9125_s);
// printf("res_x=%d res_y=%d x=%d y=%d b=%d s=%d\n", pat9125_xres, pat9125_yres, pat9125_x, pat9125_y, pat9125_b, pat9125_s);
printf("x=%d y=%d b=%d s=%d\n", pat9125_x, pat9125_y, pat9125_b, pat9125_s);
return;
}
if (strchr_pointer[1+4] == '!')
Expand Down
Loading

0 comments on commit 2dca6ef

Please sign in to comment.