Buffer size > 16

master
Erik van der Zalm 13 years ago
parent 2643ae93d6
commit 331e82dcd3

@ -311,9 +311,9 @@ const int dropsegments=0; //everything with less than this number of steps will
// The number of linear motions that can be in the plan at any give time.
// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ringbuffering.
#if defined SDSUPPORT
#define BLOCK_BUFFER_SIZE 8 // SD,LCD,Buttons take more memory, block buffer needs to be smaller
#define BLOCK_BUFFER_SIZE 16 // SD,LCD,Buttons take more memory, block buffer needs to be smaller
#else
#define BLOCK_BUFFER_SIZE 8 // maximize block buffer
#define BLOCK_BUFFER_SIZE 16 // maximize block buffer
#endif

@ -203,6 +203,7 @@ void manage_heater()
#endif
}
#define PGM_RD_W(x) (short)pgm_read_word(&x)
// Takes hot end temperature value as input and returns corresponding raw value.
// For a thermistor, it uses the RepRap thermistor temp table.
// This is needed because PID in hydra firmware hovers around a given analog value, not a temp value.
@ -214,18 +215,18 @@ int temp2analog(int celsius) {
for (i=1; i<NUMTEMPS_HEATER_0; i++)
{
if (pgm_read_word(&(heater_0_temptable[i][1])) < celsius)
if (PGM_RD_W(heater_0_temptable[i][1]) < celsius)
{
raw = pgm_read_word(&(heater_0_temptable[i-1][0])) +
(celsius - pgm_read_word(&(heater_0_temptable[i-1][1]))) *
(pgm_read_word(&(heater_0_temptable[i][0])) - pgm_read_word(&(heater_0_temptable[i-1][0]))) /
(pgm_read_word(&(heater_0_temptable[i][1])) - pgm_read_word(&(heater_0_temptable[i-1][1])));
raw = PGM_RD_W(heater_0_temptable[i-1][0]) +
(celsius - PGM_RD_W(heater_0_temptable[i-1][1])) *
(PGM_RD_W(heater_0_temptable[i][0]) - PGM_RD_W(heater_0_temptable[i-1][0])) /
(PGM_RD_W(heater_0_temptable[i][1]) - PGM_RD_W(heater_0_temptable[i-1][1]));
break;
}
}
// Overflow: Set to last value in the table
if (i == NUMTEMPS_HEATER_0) raw = pgm_read_word(&(heater_0_temptable[i-1][0]));
if (i == NUMTEMPS_HEATER_0) raw = PGM_RD_W(heater_0_temptable[i-1][0]);
return (1023 * OVERSAMPLENR) - raw;
#elif defined HEATER_0_USES_AD595
@ -245,19 +246,19 @@ int temp2analogBed(int celsius) {
for (i=1; i<BNUMTEMPS; i++)
{
if (pgm_read_word(&)bedtemptable[i][1])) < celsius)
if (PGM_RD_W(bedtemptable[i][1]) < celsius)
{
raw = pgm_read_word(&(bedtemptable[i-1][0])) +
(celsius - pgm_read_word(&(bedtemptable[i-1][1]))) *
(pgm_read_word(&(bedtemptable[i][0])) - pgm_read_word(&(bedtemptable[i-1][0]))) /
(pgm_read_word(&(bedtemptable[i][1])) - pgm_read_word(&(bedtemptable[i-1][1])));
raw = PGM_RD_W(bedtemptable[i-1][0]) +
(celsius - PGM_RD_W(bedtemptable[i-1][1])) *
(PGM_RD_W(bedtemptable[i][0]) - PGM_RD_W(bedtemptable[i-1][0])) /
(PGM_RD_W(bedtemptable[i][1]) - PGM_RD_W(bedtemptable[i-1][1]));
break;
}
}
// Overflow: Set to last value in the table
if (i == BNUMTEMPS) raw = pgm_read_word(&(bedtemptable[i-1][0]));
if (i == BNUMTEMPS) raw = PGM_RD_W(bedtemptable[i-1][0]);
return (1023 * OVERSAMPLENR) - raw;
#elif defined BED_USES_AD595
@ -274,18 +275,18 @@ float analog2temp(int raw) {
raw = (1023 * OVERSAMPLENR) - raw;
for (i=1; i<NUMTEMPS_HEATER_0; i++)
{
if ((short)pgm_read_word(&heater_0_temptable[i][0]) > raw)
if (PGM_RD_W(heater_0_temptable[i][0]) > raw)
{
celsius = (short)pgm_read_word(&heater_0_temptable[i-1][1]) +
(raw - (short)pgm_read_word(&heater_0_temptable[i-1][0])) *
(float)((short)pgm_read_word(&heater_0_temptable[i][1]) - (short)pgm_read_word(&heater_0_temptable[i-1][1])) /
(float)((short)pgm_read_word(&heater_0_temptable[i][0]) - (short)pgm_read_word(&heater_0_temptable[i-1][0]));
celsius = PGM_RD_W(heater_0_temptable[i-1][1]) +
(raw - PGM_RD_W(heater_0_temptable[i-1][0])) *
(float)(PGM_RD_W(heater_0_temptable[i][1]) - PGM_RD_W(heater_0_temptable[i-1][1])) /
(float)(PGM_RD_W(heater_0_temptable[i][0]) - PGM_RD_W(heater_0_temptable[i-1][0]));
break;
}
}
// Overflow: Set to last value in the table
if (i == NUMTEMPS_HEATER_0) celsius = (short)pgm_read_word(&(heater_0_temptable[i-1][1]));
if (i == NUMTEMPS_HEATER_0) celsius = PGM_RD_W(heater_0_temptable[i-1][1]);
return celsius;
#elif defined HEATER_0_USES_AD595
@ -304,19 +305,19 @@ float analog2tempBed(int raw) {
for (i=1; i<BNUMTEMPS; i++)
{
if (pgm_read_word(&(bedtemptable[i][0])) > raw)
if (PGM_RD_W(bedtemptable[i][0]) > raw)
{
celsius = pgm_read_word(&(bedtemptable[i-1][1])) +
(raw - pgm_read_word(&(bedtemptable[i-1][0]))) *
(pgm_read_word(&(bedtemptable[i][1])) - pgm_read_word(&(bedtemptable[i-1][1]))) /
(pgm_read_word(&(bedtemptable[i][0])) - pgm_read_word(&(bedtemptable[i-1][0])));
celsius = PGM_RD_W(bedtemptable[i-1][1]) +
(raw - PGM_RD_W(bedtemptable[i-1][0])) *
(PGM_RD_W(bedtemptable[i][1]) - PGM_RD_W(bedtemptable[i-1][1])) /
(PGM_RD_W(bedtemptable[i][0]) - PGM_RD_W(bedtemptable[i-1][0]));
break;
}
}
// Overflow: Set to last value in the table
if (i == BNUMTEMPS) celsius = pgm_read_word(&(bedtemptable[i-1][1]));
if (i == BNUMTEMPS) celsius = PGM_RD_W(bedtemptable[i-1][1]);
return celsius;

@ -88,6 +88,7 @@
#else //no lcd
#define LCD_STATUS
#define LCD_MESSAGE(x)
#define LCD_MESSAGEPGM(x)
inline void lcd_status() {};
#endif

Loading…
Cancel
Save