From 331e82dcd3d7eaf9f76dbec8759f2f730335fea3 Mon Sep 17 00:00:00 2001 From: Erik van der Zalm Date: Mon, 14 Nov 2011 18:53:09 +0100 Subject: [PATCH] Buffer size > 16 --- Marlin/Configuration.h | 4 +- Marlin/temperature.cpp | 49 +++++----- Marlin/ultralcd.h | 203 +++++++++++++++++++++-------------------- 3 files changed, 129 insertions(+), 127 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 2d890b7..89104fd 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -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 diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 89ee47d..4206410 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -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 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 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; diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 4c72532..bc07c25 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -1,102 +1,103 @@ -#ifndef __ULTRALCDH -#define __ULTRALCDH -#include "Configuration.h" - -#ifdef ULTRA_LCD - - void lcd_status(); - void lcd_init(); - void lcd_status(const char* message); - void beep(); - void buttons_check(); - - - #define LCD_UPDATE_INTERVAL 100 - #define STATUSTIMEOUT 15000 - - - #include - extern LiquidCrystal lcd; - - - #ifdef NEWPANEL - - - #define EN_C (1< + extern LiquidCrystal lcd; + + + #ifdef NEWPANEL + + + #define EN_C (1<