Buffer size > 16
This commit is contained in:
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;
|
||||
|
||||
|
@ -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 <LiquidCrystal.h>
|
||||
extern LiquidCrystal lcd;
|
||||
|
||||
|
||||
#ifdef NEWPANEL
|
||||
|
||||
|
||||
#define EN_C (1<<BLEN_C)
|
||||
#define EN_B (1<<BLEN_B)
|
||||
#define EN_A (1<<BLEN_A)
|
||||
|
||||
#define CLICKED (buttons&EN_C)
|
||||
#define BLOCK {blocking=millis()+blocktime;}
|
||||
#define CARDINSERTED (READ(SDCARDDETECT)==0)
|
||||
|
||||
#else
|
||||
|
||||
//atomatic, do not change
|
||||
#define B_LE (1<<BL_LE)
|
||||
#define B_UP (1<<BL_UP)
|
||||
#define B_MI (1<<BL_MI)
|
||||
#define B_DW (1<<BL_DW)
|
||||
#define B_RI (1<<BL_RI)
|
||||
#define B_ST (1<<BL_ST)
|
||||
#define EN_B (1<<BLEN_B)
|
||||
#define EN_A (1<<BLEN_A)
|
||||
|
||||
#define CLICKED ((buttons&B_MI)||(buttons&B_ST))
|
||||
#define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
|
||||
|
||||
#endif
|
||||
|
||||
// blocking time for recognizing a new keypress of one key, ms
|
||||
#define blocktime 500
|
||||
#define lcdslow 5
|
||||
|
||||
enum MainStatus{Main_Status, Main_Menu, Main_Prepare, Main_Control, Main_SD};
|
||||
|
||||
class MainMenu{
|
||||
public:
|
||||
MainMenu();
|
||||
void update();
|
||||
uint8_t activeline;
|
||||
MainStatus status;
|
||||
uint8_t displayStartingRow;
|
||||
|
||||
void showStatus();
|
||||
void showMainMenu();
|
||||
void showPrepare();
|
||||
void showControl();
|
||||
void showSD();
|
||||
bool force_lcd_update;
|
||||
int lastencoderpos;
|
||||
int8_t lineoffset;
|
||||
int8_t lastlineoffset;
|
||||
|
||||
bool linechanging;
|
||||
};
|
||||
|
||||
//conversion routines, could need some overworking
|
||||
char *fillto(int8_t n,char *c);
|
||||
char *ftostr51(const float &x);
|
||||
char *ftostr31(const float &x);
|
||||
char *ftostr3(const float &x);
|
||||
|
||||
|
||||
|
||||
#define LCD_MESSAGE(x) lcd_status(x);
|
||||
#define LCD_MESSAGEPGM(x) lcd_statuspgm(PSTR(x));
|
||||
#define LCD_STATUS lcd_status()
|
||||
#else //no lcd
|
||||
#define LCD_STATUS
|
||||
#define LCD_MESSAGE(x)
|
||||
inline void lcd_status() {};
|
||||
#endif
|
||||
|
||||
#ifndef ULTIPANEL
|
||||
#define CLICKED false
|
||||
#define BLOCK ;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif //ULTRALCD
|
||||
#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 <LiquidCrystal.h>
|
||||
extern LiquidCrystal lcd;
|
||||
|
||||
|
||||
#ifdef NEWPANEL
|
||||
|
||||
|
||||
#define EN_C (1<<BLEN_C)
|
||||
#define EN_B (1<<BLEN_B)
|
||||
#define EN_A (1<<BLEN_A)
|
||||
|
||||
#define CLICKED (buttons&EN_C)
|
||||
#define BLOCK {blocking=millis()+blocktime;}
|
||||
#define CARDINSERTED (READ(SDCARDDETECT)==0)
|
||||
|
||||
#else
|
||||
|
||||
//atomatic, do not change
|
||||
#define B_LE (1<<BL_LE)
|
||||
#define B_UP (1<<BL_UP)
|
||||
#define B_MI (1<<BL_MI)
|
||||
#define B_DW (1<<BL_DW)
|
||||
#define B_RI (1<<BL_RI)
|
||||
#define B_ST (1<<BL_ST)
|
||||
#define EN_B (1<<BLEN_B)
|
||||
#define EN_A (1<<BLEN_A)
|
||||
|
||||
#define CLICKED ((buttons&B_MI)||(buttons&B_ST))
|
||||
#define BLOCK {blocking[BL_MI]=millis()+blocktime;blocking[BL_ST]=millis()+blocktime;}
|
||||
|
||||
#endif
|
||||
|
||||
// blocking time for recognizing a new keypress of one key, ms
|
||||
#define blocktime 500
|
||||
#define lcdslow 5
|
||||
|
||||
enum MainStatus{Main_Status, Main_Menu, Main_Prepare, Main_Control, Main_SD};
|
||||
|
||||
class MainMenu{
|
||||
public:
|
||||
MainMenu();
|
||||
void update();
|
||||
uint8_t activeline;
|
||||
MainStatus status;
|
||||
uint8_t displayStartingRow;
|
||||
|
||||
void showStatus();
|
||||
void showMainMenu();
|
||||
void showPrepare();
|
||||
void showControl();
|
||||
void showSD();
|
||||
bool force_lcd_update;
|
||||
int lastencoderpos;
|
||||
int8_t lineoffset;
|
||||
int8_t lastlineoffset;
|
||||
|
||||
bool linechanging;
|
||||
};
|
||||
|
||||
//conversion routines, could need some overworking
|
||||
char *fillto(int8_t n,char *c);
|
||||
char *ftostr51(const float &x);
|
||||
char *ftostr31(const float &x);
|
||||
char *ftostr3(const float &x);
|
||||
|
||||
|
||||
|
||||
#define LCD_MESSAGE(x) lcd_status(x);
|
||||
#define LCD_MESSAGEPGM(x) lcd_statuspgm(PSTR(x));
|
||||
#define LCD_STATUS lcd_status()
|
||||
#else //no lcd
|
||||
#define LCD_STATUS
|
||||
#define LCD_MESSAGE(x)
|
||||
#define LCD_MESSAGEPGM(x)
|
||||
inline void lcd_status() {};
|
||||
#endif
|
||||
|
||||
#ifndef ULTIPANEL
|
||||
#define CLICKED false
|
||||
#define BLOCK ;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif //ULTRALCD
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user