Skip to content

Commit

Permalink
Added some changes for newest AVR toolchain.
Browse files Browse the repository at this point in the history
  • Loading branch information
repetier committed Apr 25, 2012
1 parent bbc923e commit 2f9c693
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
7 changes: 4 additions & 3 deletions Repetier/Repetier.pde
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Custom M Codes
- M232 - Read and reset max. advance values
- M233 X<AdvanceK> - Set temporary advance K-value to X
*/

#include "Configuration.h"
#include "Reptier.h"
#include "Eeprom.h"
Expand Down Expand Up @@ -606,10 +607,10 @@ inline long Div4U2U(unsigned long a,unsigned int b) {
return a;
}

const prog_uint16_t fast_div_lut[17] PROGMEM = {0,F_CPU/4096,F_CPU/8192,F_CPU/12288,F_CPU/16384,F_CPU/20480,F_CPU/24576,F_CPU/28672,F_CPU/32768,F_CPU/36864
const uint16_t fast_div_lut[17] PROGMEM = {0,F_CPU/4096,F_CPU/8192,F_CPU/12288,F_CPU/16384,F_CPU/20480,F_CPU/24576,F_CPU/28672,F_CPU/32768,F_CPU/36864
,F_CPU/40960,F_CPU/45056,F_CPU/49152,F_CPU/53248,F_CPU/57344,F_CPU/61440,F_CPU/65536};

const prog_uint16_t slow_div_lut[257] PROGMEM = {0,F_CPU/32,F_CPU/64,F_CPU/96,F_CPU/128,F_CPU/160,F_CPU/192,F_CPU/224,F_CPU/256,F_CPU/288,F_CPU/320,F_CPU/352
const uint16_t slow_div_lut[257] PROGMEM = {0,F_CPU/32,F_CPU/64,F_CPU/96,F_CPU/128,F_CPU/160,F_CPU/192,F_CPU/224,F_CPU/256,F_CPU/288,F_CPU/320,F_CPU/352
,F_CPU/384,F_CPU/416,F_CPU/448,F_CPU/480,F_CPU/512,F_CPU/544,F_CPU/576,F_CPU/608,F_CPU/640,F_CPU/672,F_CPU/704,F_CPU/736,F_CPU/768,F_CPU/800,F_CPU/832
,F_CPU/864,F_CPU/896,F_CPU/928,F_CPU/960,F_CPU/992,F_CPU/1024,F_CPU/1056,F_CPU/1088,F_CPU/1120,F_CPU/1152,F_CPU/1184,F_CPU/1216,F_CPU/1248,F_CPU/1280,F_CPU/1312
,F_CPU/1344,F_CPU/1376,F_CPU/1408,F_CPU/1440,F_CPU/1472,F_CPU/1504,F_CPU/1536,F_CPU/1568,F_CPU/1600,F_CPU/1632,F_CPU/1664,F_CPU/1696,F_CPU/1728,F_CPU/1760,F_CPU/1792
Expand Down Expand Up @@ -1949,4 +1950,4 @@ ISR(EXTRUDER_TIMER_VECTOR)
UI_FAST; // Short timed user interface action
}



16 changes: 8 additions & 8 deletions Repetier/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#define UI_MAIN
#include <avr/pgmspace.h>
extern int8_t encoder_table[16] PROGMEM ;
extern const int8_t encoder_table[16] PROGMEM ;
#include "ui.h"
#include "Reptier.h"
#include <math.h>
Expand All @@ -31,11 +31,11 @@ extern int8_t encoder_table[16] PROGMEM ;
#include <ctype.h>

#if UI_ENCODER_SPEED==0
int8_t encoder_table[16] PROGMEM = {0,1,-1,0,-1,0,0,1,1,0,0,-1,0,-1,1,0}; // Full speed
const int8_t encoder_table[16] PROGMEM = {0,1,-1,0,-1,0,0,1,1,0,0,-1,0,-1,1,0}; // Full speed
#elif UI_ENCODER_SPEED==1
int8_t encoder_table[16] PROGMEM = {0,0,-1,0,0,0,0,1,1,0,0,0,0,-1,0,0}; // Half speed
const int8_t encoder_table[16] PROGMEM = {0,0,-1,0,0,0,0,1,1,0,0,0,0,-1,0,0}; // Half speed
#else
int8_t encoder_table[16] PROGMEM = {0,0,0,0,0,0,0,0,1,0,0,0,0,-1,0,0}; // Quart speed
const int8_t encoder_table[16] PROGMEM = {0,0,0,0,0,0,0,0,1,0,0,0,0,-1,0,0}; // Quart speed
#endif


Expand Down Expand Up @@ -353,7 +353,7 @@ const long baudrates[] PROGMEM = {9600,14400,19200,28800,38400,56000,57600,76800
#define lcdPutChar(value) lcdWriteByte(value,1)
#define lcdCommand(value) lcdWriteByte(value,0)

static byte LCDLineOffsets[] PROGMEM = UI_LINE_OFFSETS;
static const byte LCDLineOffsets[] PROGMEM = UI_LINE_OFFSETS;
static const char versionString[] PROGMEM = UI_VERSION_STRING;
static const char versionString2[] PROGMEM = UI_VERSION_STRING2;

Expand Down Expand Up @@ -864,7 +864,7 @@ void UIDisplay::parse(char *txt,bool ram) {
break;
}
if(c2=='c') {addLong(baudrate,6);break;}
if(c2=='e') {if(errorMsg!=0)addStringP((prog_char*)errorMsg);break;}
if(c2=='e') {if(errorMsg!=0)addStringP((char PROGMEM *)errorMsg);break;}
if(c2=='B') {addInt((int)lines_count,2);break;}
if(c2=='m') {addInt(printer_state.feedrateMultiply,3);break;}
// Extruder output level
Expand Down Expand Up @@ -964,7 +964,7 @@ void UIDisplay::setStatus(char *txt) {
statusMsg[i]=0;
}

const UIMenu *ui_pages[UI_NUM_PAGES] PROGMEM = UI_PAGES;
const UIMenu * const ui_pages[UI_NUM_PAGES] PROGMEM = UI_PAGES;
#ifdef SDSUPPORT
byte nFilesOnCard;

Expand Down Expand Up @@ -1857,4 +1857,4 @@ void UIDisplay::fastAction() {
}

#endif


18 changes: 9 additions & 9 deletions Repetier/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
#include "fastio.h"

typedef struct {
char *text; // Menu text
const char *text; // Menu text
unsigned char menuType; // 0 = Info, 1 = Headline, 2 = submenu ref, 3 = direct action command, 4 = modify action command
unsigned int action;
} const UIMenuEntry;
Expand All @@ -167,7 +167,7 @@ typedef struct {
unsigned char menuType;
int id; // Type of modification
int numEntries;
UIMenuEntry **entries;
const UIMenuEntry * const * entries;
} const UIMenu;

//#ifdef COMPILE_I2C_DRIVER
Expand Down Expand Up @@ -301,19 +301,19 @@ extern unsigned char i2c_read(unsigned char ack);
#define UI_KEYS_I2C_CLICKENCODER_HIGH_REV(pinA,pinB) uid.encoderLast = (uid.encoderLast << 2) & 0x0F;if (keymask & pinA) uid.encoderLast |=2;if (keymask & pinB) uid.encoderLast |=1; uid.encoderPos -= pgm_read_byte(&encoder_table[uid.encoderLast]);
#define UI_KEYS_I2C_BUTTON_HIGH(pin,action_) if((pin & keymask)!=0) action=action_;

#define UI_STRING(name,text) prog_char name[] PROGMEM = text;
#define UI_STRING(name,text) const char PROGMEM name[] = text;

#define UI_PAGE4(name,row1,row2,row3,row4) UI_STRING(name ## _1txt,row1);UI_STRING(name ## _2txt,row2);UI_STRING(name ## _3txt,row3);UI_STRING(name ## _4txt,row4);\
UIMenuEntry name ## _1 PROGMEM ={name ## _1txt,0,0};\
UIMenuEntry name ## _2 PROGMEM ={name ## _2txt,0,0};\
UIMenuEntry name ## _3 PROGMEM ={name ## _3txt,0,0};\
UIMenuEntry name ## _4 PROGMEM ={name ## _4txt,0,0};\
const UIMenuEntry *name ## _entries[] PROGMEM = {&name ## _1,&name ## _2,&name ## _3,&name ## _4};\
const UIMenuEntry * const name ## _entries [] PROGMEM = {&name ## _1,&name ## _2,&name ## _3,&name ## _4};\
const UIMenu name PROGMEM = {0,0,4,name ## _entries};
#define UI_PAGE2(name,row1,row2) UI_STRING(name ## _1txt,row1);UI_STRING(name ## _2txt,row2);\
UIMenuEntry name ## _1 PROGMEM ={name ## _1txt,0,0};\
UIMenuEntry name ## _2 PROGMEM ={name ## _2txt,0,0};\
const UIMenuEntry *name ## _entries[] PROGMEM = {&name ## _1,&name ## _2};\
const UIMenuEntry * const name ## _entries[] PROGMEM = {&name ## _1,&name ## _2};\
const UIMenu name PROGMEM = {0,0,2,name ## _entries};
#define UI_MENU_ACTION4C(name,action,rows) UI_MENU_ACTION4(name,action,rows)
#define UI_MENU_ACTION2C(name,action,rows) UI_MENU_ACTION2(name,action,rows)
Expand All @@ -322,19 +322,19 @@ extern unsigned char i2c_read(unsigned char ack);
UIMenuEntry name ## _2 PROGMEM ={name ## _2txt,0,0};\
UIMenuEntry name ## _3 PROGMEM ={name ## _3txt,0,0};\
UIMenuEntry name ## _4 PROGMEM ={name ## _4txt,0,0};\
const UIMenuEntry *name ## _entries[] PROGMEM = {&name ## _1,&name ## _2,&name ## _3,&name ## _4};\
const UIMenuEntry * const name ## _entries[] PROGMEM = {&name ## _1,&name ## _2,&name ## _3,&name ## _4};\
const UIMenu name PROGMEM = {3,action,4,name ## _entries};
#define UI_MENU_ACTION2(name,action,row1,row2) UI_STRING(name ## _1txt,row1);UI_STRING(name ## _2txt,row2);\
UIMenuEntry name ## _1 PROGMEM ={name ## _1txt,0,0};\
UIMenuEntry name ## _2 PROGMEM ={name ## _2txt,0,0};\
const UIMenuEntry *name ## _entries[] PROGMEM = {&name ## _1,&name ## _2};\
const UIMenuEntry * const name ## _entries[] PROGMEM = {&name ## _1,&name ## _2};\
const UIMenu name PROGMEM = {3,action,2,name ## _entries};
#define UI_MENU_HEADLINE(name,text) UI_STRING(name ## _txt,text);UIMenuEntry name PROGMEM = {name ## _txt,1,0};
#define UI_MENU_CHANGEACTION(name,row,action) UI_STRING(name ## _txt,row);UIMenuEntry name PROGMEM = {name ## _txt,4,action};
#define UI_MENU_ACTIONCOMMAND(name,row,action) UI_STRING(name ## _txt,row);UIMenuEntry name PROGMEM = {name ## _txt,3,action};
#define UI_MENU_ACTIONSELECTOR(name,row,entries) UI_STRING(name ## _txt,row);UIMenuEntry name PROGMEM = {name ## _txt,2,(unsigned int)&entries};
#define UI_MENU_SUBMENU(name,row,entries) UI_STRING(name ## _txt,row);UIMenuEntry name PROGMEM = {name ## _txt,2,(unsigned int)&entries};
#define UI_MENU(name,items,itemsCnt) const UIMenuEntry *name ## _entries[] PROGMEM = items;const UIMenu name PROGMEM = {2,0,itemsCnt,name ## _entries}
#define UI_MENU(name,items,itemsCnt) const UIMenuEntry * const name ## _entries[] PROGMEM = items;const UIMenu name PROGMEM = {2,0,itemsCnt,name ## _entries}
#define UI_MENU_FILESELECT(name,items,itemsCnt) const UIMenuEntry *name ## _entries[] PROGMEM = items;const UIMenu name PROGMEM = {1,0,itemsCnt,name ## _entries}

class UIDisplay {
Expand Down Expand Up @@ -435,4 +435,4 @@ extern UIDisplay uid;
extern void beep(byte duration,byte count);

#endif


0 comments on commit 2f9c693

Please sign in to comment.