Commit 55eff722 authored by MagoKimbra's avatar MagoKimbra

Return to PROGMEM

parent 93053b8b
...@@ -96,19 +96,19 @@ void Config_StoreSettings() ...@@ -96,19 +96,19 @@ void Config_StoreSettings()
EEPROM_WRITE_VAR(i,lcd_contrast); EEPROM_WRITE_VAR(i,lcd_contrast);
#ifdef SCARA #ifdef SCARA
EEPROM_WRITE_VAR(i,axis_scaling); // Add scaling for SCARA EEPROM_WRITE_VAR(i,axis_scaling); // Add scaling for SCARA
#endif #endif //SCARA
#ifdef FWRETRACT #ifdef FWRETRACT
EEPROM_WRITE_VAR(i,autoretract_enabled); EEPROM_WRITE_VAR(i,autoretract_enabled);
EEPROM_WRITE_VAR(i,retract_length); EEPROM_WRITE_VAR(i,retract_length);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
EEPROM_WRITE_VAR(i,retract_length_swap); EEPROM_WRITE_VAR(i,retract_length_swap);
#endif #endif //EXTRUDERS > 1
EEPROM_WRITE_VAR(i,retract_feedrate); EEPROM_WRITE_VAR(i,retract_feedrate);
EEPROM_WRITE_VAR(i,retract_zlift); EEPROM_WRITE_VAR(i,retract_zlift);
EEPROM_WRITE_VAR(i,retract_recover_length); EEPROM_WRITE_VAR(i,retract_recover_length);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
EEPROM_WRITE_VAR(i,retract_recover_length_swap); EEPROM_WRITE_VAR(i,retract_recover_length_swap);
#endif #endif //EXTRUDERS > 1
EEPROM_WRITE_VAR(i,retract_recover_feedrate); EEPROM_WRITE_VAR(i,retract_recover_feedrate);
#endif // FWRETRACT #endif // FWRETRACT
...@@ -121,9 +121,9 @@ void Config_StoreSettings() ...@@ -121,9 +121,9 @@ void Config_StoreSettings()
EEPROM_WRITE_VAR(i, filament_size[2]); EEPROM_WRITE_VAR(i, filament_size[2]);
#if EXTRUDERS > 3 #if EXTRUDERS > 3
EEPROM_WRITE_VAR(i, filament_size[3]); EEPROM_WRITE_VAR(i, filament_size[3]);
#endif #endif //EXTRUDERS > 3
#endif #endif //EXTRUDERS > 2
#endif #endif //EXTRUDERS > 1
char ver2[4]=EEPROM_VERSION; char ver2[4]=EEPROM_VERSION;
i=EEPROM_OFFSET; i=EEPROM_OFFSET;
...@@ -301,7 +301,7 @@ void Config_PrintSettings() ...@@ -301,7 +301,7 @@ void Config_PrintSettings()
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" Swap rec. addl. length (mm): ", retract_recover_length_swap); SERIAL_ECHOPAIR(" Swap rec. addl. length (mm): ", retract_recover_length_swap);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
#endif #endif //EXTRUDERS > 1
SERIAL_ECHO_START; SERIAL_ECHO_START;
if (volumetric_enabled) { if (volumetric_enabled) {
SERIAL_ECHOLNPGM("Filament settings:"); SERIAL_ECHOLNPGM("Filament settings:");
...@@ -309,26 +309,26 @@ void Config_PrintSettings() ...@@ -309,26 +309,26 @@ void Config_PrintSettings()
SERIAL_ECHOPAIR(" M200 D", filament_size[0]); SERIAL_ECHOPAIR(" M200 D", filament_size[0]);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
#if EXTRUDERS > 1 #if EXTRUDERS > 1
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M200 T1 D", filament_size[1]); SERIAL_ECHOPAIR(" M200 T1 D", filament_size[1]);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
#if EXTRUDERS > 2 #if EXTRUDERS > 2
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M200 T2 D", filament_size[2]); SERIAL_ECHOPAIR(" M200 T2 D", filament_size[2]);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
#if EXTRUDERS > 3 #if EXTRUDERS > 3
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOPAIR(" M200 T3 D", filament_size[3]); SERIAL_ECHOPAIR(" M200 T3 D", filament_size[3]);
SERIAL_ECHOLN(""); SERIAL_ECHOLN("");
#endif #endif //EXTRUDERS > 3
#endif #endif //EXTRUDERS > 2
#endif #endif //EXTRUDERS > 1
} else { } else {
SERIAL_ECHOLNPGM("Filament settings: Disabled"); SERIAL_ECHOLNPGM("Filament settings: Disabled");
} }
#endif #endif //FWRETRACT
} }
#endif #endif //DISABLE_M503
#ifdef EEPROM_SETTINGS #ifdef EEPROM_SETTINGS
...@@ -402,35 +402,35 @@ void Config_RetrieveSettings() ...@@ -402,35 +402,35 @@ void Config_RetrieveSettings()
EEPROM_READ_VAR(i,lcd_contrast); EEPROM_READ_VAR(i,lcd_contrast);
#ifdef SCARA #ifdef SCARA
EEPROM_READ_VAR(i,axis_scaling); EEPROM_READ_VAR(i,axis_scaling);
#endif #endif //SCARA
#ifdef FWRETRACT #ifdef FWRETRACT
EEPROM_READ_VAR(i,autoretract_enabled); EEPROM_READ_VAR(i,autoretract_enabled);
EEPROM_READ_VAR(i,retract_length); EEPROM_READ_VAR(i,retract_length);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
EEPROM_READ_VAR(i,retract_length_swap); EEPROM_READ_VAR(i,retract_length_swap);
#endif #endif //EXTRUDERS > 1
EEPROM_READ_VAR(i,retract_feedrate); EEPROM_READ_VAR(i,retract_feedrate);
EEPROM_READ_VAR(i,retract_zlift); EEPROM_READ_VAR(i,retract_zlift);
EEPROM_READ_VAR(i,retract_recover_length); EEPROM_READ_VAR(i,retract_recover_length);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
EEPROM_READ_VAR(i,retract_recover_length_swap); EEPROM_READ_VAR(i,retract_recover_length_swap);
#endif #endif //EXTRUDERS > 1
EEPROM_READ_VAR(i,retract_recover_feedrate); EEPROM_READ_VAR(i,retract_recover_feedrate);
#endif #endif
EEPROM_READ_VAR(i, volumetric_enabled); EEPROM_READ_VAR(i, volumetric_enabled);
EEPROM_READ_VAR(i, filament_size[0]); EEPROM_READ_VAR(i, filament_size[0]);
#if EXTRUDERS > 1 #if EXTRUDERS > 1
EEPROM_READ_VAR(i, filament_size[1]); EEPROM_READ_VAR(i, filament_size[1]);
#if EXTRUDERS > 2 #if EXTRUDERS > 2
EEPROM_READ_VAR(i, filament_size[2]); EEPROM_READ_VAR(i, filament_size[2]);
#if EXTRUDERS > 3 #if EXTRUDERS > 3
EEPROM_READ_VAR(i, filament_size[3]); EEPROM_READ_VAR(i, filament_size[3]);
#endif #endif //EXTRUDERS > 3
#endif #endif //EXTRUDERS > 2
#endif #endif //EXTRUDERS > 1
calculate_volumetric_multipliers(); calculate_volumetric_multipliers();
// Call updatePID (similar to when we have processed M301) // Call updatePID (similar to when we have processed M301)
updatePID(); updatePID();
SERIAL_ECHO_START; SERIAL_ECHO_START;
...@@ -451,26 +451,26 @@ void Config_ResetDefault() ...@@ -451,26 +451,26 @@ void Config_ResetDefault()
//Setting default baudrate for serial //Setting default baudrate for serial
baudrate=BAUDRATE; baudrate=BAUDRATE;
const static float tmp1[] MARLIN_PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT; const static float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
const static float tmp2[] MARLIN_PROGMEM = DEFAULT_MAX_FEEDRATE; const static float tmp2[] = DEFAULT_MAX_FEEDRATE;
const static float tmp3[] MARLIN_PROGMEM = DEFAULT_RETRACTION_MAX_FEEDRATE; const static float tmp3[] = DEFAULT_RETRACTION_MAX_FEEDRATE;
const static long tmp4[] MARLIN_PROGMEM = DEFAULT_MAX_ACCELERATION; const static long tmp4[] = DEFAULT_MAX_ACCELERATION;
#ifdef PIDTEMP #ifdef PIDTEMP
const static float tmp5[] MARLIN_PROGMEM = DEFAULT_Kp; const static float tmp5[] = DEFAULT_Kp;
const static float tmp6[] MARLIN_PROGMEM = DEFAULT_Ki; const static float tmp6[] = DEFAULT_Ki;
const static float tmp7[] MARLIN_PROGMEM = DEFAULT_Kd; const static float tmp7[] = DEFAULT_Kd;
#endif // PIDTEMP #endif // PIDTEMP
for (short i=0;i<7;i++) for (short i=0;i<7;i++)
{ {
axis_steps_per_unit[i] = pgm_read_float(&tmp1[i]); axis_steps_per_unit[i] = tmp1[i];
max_feedrate[i] = pgm_read_float(&tmp2[i]); max_feedrate[i] = tmp2[i];
max_acceleration_units_per_sq_second[i]=pgm_read_float(&tmp4[i]); max_acceleration_units_per_sq_second[i] = tmp4[i];
} }
for (short i=0;i<4;i++) for (short i=0;i<4;i++)
{ {
max_retraction_feedrate[i]=pgm_read_float(&tmp3[i]); max_retraction_feedrate[i] = tmp3[i];
#ifdef SCARA #ifdef SCARA
axis_scaling[i]=1; axis_scaling[i]=1;
#endif #endif
...@@ -515,50 +515,47 @@ void Config_ResetDefault() ...@@ -515,50 +515,47 @@ void Config_ResetDefault()
lcd_contrast = DEFAULT_LCD_CONTRAST; lcd_contrast = DEFAULT_LCD_CONTRAST;
#endif #endif
#ifdef PIDTEMP #ifdef PIDTEMP
// call updatePID (similar to when we have processed M301) #ifndef SINGLENOZZLE
updatePID(); for (short e=0;e<4;e++)
for (short i=0;i<4;i++)
{
#ifdef SINGLENOZZLE
Kp[i] = pgm_read_float(&tmp5[0]);;
Ki[i] = scalePID_i(pgm_read_float(&tmp6[0]));
Kd[i] = scalePID_d(pgm_read_float(&tmp7[0]));
#else #else
Kp[i] = pgm_read_float(&tmp5[i]);; int e = 0; // only need to write once
Ki[i] = scalePID_i(pgm_read_float(&tmp6[i]));
Kd[i] = scalePID_d(pgm_read_float(&tmp7[i]));
#endif #endif
{
Kp[e] = tmp5[e];
Ki[e] = scalePID_i(tmp6[e]);
Kd[e] = scalePID_d(tmp7[e]);
} }
// call updatePID (similar to when we have processed M301)
updatePID();
#endif//PIDTEMP #endif//PIDTEMP
#ifdef FWRETRACT #ifdef FWRETRACT
autoretract_enabled = false; autoretract_enabled = false;
retract_length = RETRACT_LENGTH; retract_length = RETRACT_LENGTH;
#if EXTRUDERS > 1 #if EXTRUDERS > 1
retract_length_swap = RETRACT_LENGTH_SWAP; retract_length_swap = RETRACT_LENGTH_SWAP;
#endif //EXTRUDERS > 1 #endif //EXTRUDERS > 1
retract_feedrate = RETRACT_FEEDRATE; retract_feedrate = RETRACT_FEEDRATE;
retract_zlift = RETRACT_ZLIFT; retract_zlift = RETRACT_ZLIFT;
retract_recover_length = RETRACT_RECOVER_LENGTH; retract_recover_length = RETRACT_RECOVER_LENGTH;
#if EXTRUDERS > 1 #if EXTRUDERS > 1
retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP; retract_recover_length_swap = RETRACT_RECOVER_LENGTH_SWAP;
#endif //EXTRUDERS > 1 #endif //EXTRUDERS > 1
retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE; retract_recover_feedrate = RETRACT_RECOVER_FEEDRATE;
#endif //FWRETRACT #endif //FWRETRACT
volumetric_enabled = false; volumetric_enabled = false;
filament_size[0] = DEFAULT_NOMINAL_FILAMENT_DIA; filament_size[0] = DEFAULT_NOMINAL_FILAMENT_DIA;
#if EXTRUDERS > 1 #if EXTRUDERS > 1
filament_size[1] = DEFAULT_NOMINAL_FILAMENT_DIA; filament_size[1] = DEFAULT_NOMINAL_FILAMENT_DIA;
#if EXTRUDERS > 2 #if EXTRUDERS > 2
filament_size[2] = DEFAULT_NOMINAL_FILAMENT_DIA; filament_size[2] = DEFAULT_NOMINAL_FILAMENT_DIA;
#if EXTRUDERS > 3 #if EXTRUDERS > 3
filament_size[3] = DEFAULT_NOMINAL_FILAMENT_DIA; filament_size[3] = DEFAULT_NOMINAL_FILAMENT_DIA;
#endif //EXTRUDERS > 3 #endif //EXTRUDERS > 3
#endif //EXTRUDERS > 2 #endif //EXTRUDERS > 2
#endif //EXTRUDERS > 1 #endif //EXTRUDERS > 1
calculate_volumetric_multipliers(); calculate_volumetric_multipliers();
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded"); SERIAL_ECHOLNPGM("Hardcoded Default Settings Loaded");
......
...@@ -41,25 +41,6 @@ ...@@ -41,25 +41,6 @@
#include "HardwareSerial.h" #include "HardwareSerial.h"
#endif #endif
#ifdef __GNUC__
#ifndef GCC_VERSION2
#define GCC_VERSION2 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
#if GCC_VERSION2 < 40602 // Test for GCC < 4.6.2
#ifdef PROGMEM
#define MARLIN_PROGMEM __attribute__((section(".progmem.data")))
#ifdef PSTR
#undef PSTR
#define PSTR(s) (__extension__({static const prog_char __c[] MARLIN_PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source
#endif
#endif
#endif
#endif
#include "MarlinSerial.h" #include "MarlinSerial.h"
#ifndef cbi #ifndef cbi
......
...@@ -403,8 +403,8 @@ bool cancel_heatup = false ; ...@@ -403,8 +403,8 @@ bool cancel_heatup = false ;
int laser_ttl_modulation = 0; int laser_ttl_modulation = 0;
#endif #endif
const prog_char errormagic[] MARLIN_PROGMEM = "Error:"; const char errormagic[] PROGMEM = "Error:";
const prog_char echomagic[] MARLIN_PROGMEM = "echo:"; const char echomagic[] PROGMEM = "echo:";
//=========================================================================== //===========================================================================
//=============================Private Variables============================= //=============================Private Variables=============================
...@@ -971,7 +971,7 @@ DEFINE_PGM_READ_ANY(float, float); ...@@ -971,7 +971,7 @@ DEFINE_PGM_READ_ANY(float, float);
DEFINE_PGM_READ_ANY(signed char, byte); DEFINE_PGM_READ_ANY(signed char, byte);
#define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \ #define XYZ_CONSTS_FROM_CONFIG(type, array, CONFIG) \
static const type array##_P[3] MARLIN_PROGMEM = \ static const PROGMEM type array##_P[3] = \
{ X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \ { X_##CONFIG, Y_##CONFIG, Z_##CONFIG }; \
static inline type array(int axis) \ static inline type array(int axis) \
{ return pgm_read_any(&array##_P[axis]); } { return pgm_read_any(&array##_P[axis]); }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#if F_CPU == 16000000 #if F_CPU == 16000000
const prog_uint16_t speed_lookuptable_fast[256][2] MARLIN_PROGMEM = {\ const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {\
{ 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135}, { 62500, 55556}, { 6944, 3268}, { 3676, 1176}, { 2500, 607}, { 1893, 369}, { 1524, 249}, { 1275, 179}, { 1096, 135},
{ 961, 105}, { 856, 85}, { 771, 69}, { 702, 58}, { 644, 49}, { 595, 42}, { 553, 37}, { 516, 32}, { 961, 105}, { 856, 85}, { 771, 69}, { 702, 58}, { 644, 49}, { 595, 42}, { 553, 37}, { 516, 32},
{ 484, 28}, { 456, 25}, { 431, 23}, { 408, 20}, { 388, 19}, { 369, 16}, { 353, 16}, { 337, 14}, { 484, 28}, { 456, 25}, { 431, 23}, { 408, 20}, { 388, 19}, { 369, 16}, { 353, 16}, { 337, 14},
...@@ -40,7 +40,7 @@ const prog_uint16_t speed_lookuptable_fast[256][2] MARLIN_PROGMEM = {\ ...@@ -40,7 +40,7 @@ const prog_uint16_t speed_lookuptable_fast[256][2] MARLIN_PROGMEM = {\
{ 31, 0}, { 31, 0}, { 31, 0}, { 31, 1}, { 30, 0}, { 30, 0}, { 30, 0}, { 30, 0} { 31, 0}, { 31, 0}, { 31, 0}, { 31, 1}, { 30, 0}, { 30, 0}, { 30, 0}, { 30, 0}
}; };
const prog_uint16_t speed_lookuptable_slow[256][2] MARLIN_PROGMEM = {\ const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {\
{ 62500, 12500}, { 50000, 8334}, { 41666, 5952}, { 35714, 4464}, { 31250, 3473}, { 27777, 2777}, { 25000, 2273}, { 22727, 1894}, { 62500, 12500}, { 50000, 8334}, { 41666, 5952}, { 35714, 4464}, { 31250, 3473}, { 27777, 2777}, { 25000, 2273}, { 22727, 1894},
{ 20833, 1603}, { 19230, 1373}, { 17857, 1191}, { 16666, 1041}, { 15625, 920}, { 14705, 817}, { 13888, 731}, { 13157, 657}, { 20833, 1603}, { 19230, 1373}, { 17857, 1191}, { 16666, 1041}, { 15625, 920}, { 14705, 817}, { 13888, 731}, { 13157, 657},
{ 12500, 596}, { 11904, 541}, { 11363, 494}, { 10869, 453}, { 10416, 416}, { 10000, 385}, { 9615, 356}, { 9259, 331}, { 12500, 596}, { 11904, 541}, { 11363, 494}, { 10869, 453}, { 10416, 416}, { 10000, 385}, { 9615, 356}, { 9259, 331},
...@@ -77,7 +77,7 @@ const prog_uint16_t speed_lookuptable_slow[256][2] MARLIN_PROGMEM = {\ ...@@ -77,7 +77,7 @@ const prog_uint16_t speed_lookuptable_slow[256][2] MARLIN_PROGMEM = {\
#elif F_CPU == 20000000 #elif F_CPU == 20000000
const uint16_t speed_lookuptable_fast[256][2] MARLIN_PROGMEM = { const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {
{62500, 54055}, {8445, 3917}, {4528, 1434}, {3094, 745}, {2349, 456}, {1893, 307}, {1586, 222}, {1364, 167}, {62500, 54055}, {8445, 3917}, {4528, 1434}, {3094, 745}, {2349, 456}, {1893, 307}, {1586, 222}, {1364, 167},
{1197, 131}, {1066, 105}, {961, 86}, {875, 72}, {803, 61}, {742, 53}, {689, 45}, {644, 40}, {1197, 131}, {1066, 105}, {961, 86}, {875, 72}, {803, 61}, {742, 53}, {689, 45}, {644, 40},
{604, 35}, {569, 32}, {537, 28}, {509, 25}, {484, 23}, {461, 21}, {440, 19}, {421, 17}, {604, 35}, {569, 32}, {537, 28}, {509, 25}, {484, 23}, {461, 21}, {440, 19}, {421, 17},
...@@ -112,7 +112,7 @@ const uint16_t speed_lookuptable_fast[256][2] MARLIN_PROGMEM = { ...@@ -112,7 +112,7 @@ const uint16_t speed_lookuptable_fast[256][2] MARLIN_PROGMEM = {
{39, 0}, {39, 0}, {39, 1}, {38, 0}, {38, 0}, {38, 0}, {38, 0}, {38, 0}, {39, 0}, {39, 0}, {39, 1}, {38, 0}, {38, 0}, {38, 0}, {38, 0}, {38, 0},
}; };
const uint16_t speed_lookuptable_slow[256][2] MARLIN_PROGMEM = { const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {
{62500, 10417}, {52083, 7441}, {44642, 5580}, {39062, 4340}, {34722, 3472}, {31250, 2841}, {28409, 2368}, {26041, 2003}, {62500, 10417}, {52083, 7441}, {44642, 5580}, {39062, 4340}, {34722, 3472}, {31250, 2841}, {28409, 2368}, {26041, 2003},
{24038, 1717}, {22321, 1488}, {20833, 1302}, {19531, 1149}, {18382, 1021}, {17361, 914}, {16447, 822}, {15625, 745}, {24038, 1717}, {22321, 1488}, {20833, 1302}, {19531, 1149}, {18382, 1021}, {17361, 914}, {16447, 822}, {15625, 745},
{14880, 676}, {14204, 618}, {13586, 566}, {13020, 520}, {12500, 481}, {12019, 445}, {11574, 414}, {11160, 385}, {14880, 676}, {14204, 618}, {13586, 566}, {13020, 520}, {12500, 481}, {12019, 445}, {11574, 414}, {11160, 385},
......
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