Permalink
Browse files

#ifdef OPTION_DOW_DATELONG in ratt.h. Uncomment to add Day of Week an…

…d Long Date formats.
  • Loading branch information...
1 parent c966b55 commit a838204919e53c55dda97f428673a87b3ec9b434 @CaitSith2 CaitSith2 committed Aug 8, 2010
Showing with 1,206 additions and 1,262 deletions.
  1. +9 −17 firmware/anim.c
  2. +14 −2 firmware/config.c
  3. +1,157 −1,237 firmware/monochron.hex
  4. +22 −6 firmware/ratt.c
  5. +4 −0 firmware/ratt.h
View
26 firmware/anim.c
@@ -15,6 +15,7 @@
#include "font5x7.h"
#include "fonttable.h"
+
extern volatile uint8_t time_s, time_m, time_h;
extern volatile uint8_t old_m, old_h;
extern volatile uint8_t date_m, date_d, date_y;
@@ -25,8 +26,10 @@ extern volatile uint8_t score_mode;
extern volatile uint8_t second_changed, minute_changed, hour_changed;
+#ifdef OPTION_DOW_DATELONG
const uint8_t DOWText[] PROGMEM = "sunmontuewedthufrisat";
const uint8_t MonthText[] PROGMEM = " janfebmaraprmayjunjulaugsepoctnovdec";
+#endif
uint8_t redraw_time = 0;
uint8_t last_score_mode = 0;
@@ -75,7 +78,9 @@ void drawdisplay(void) {
drawdigit(DISPLAY_H1_X, DISPLAY_TIME_Y, left%10, inverted);
drawdigit(DISPLAY_M10_X, DISPLAY_TIME_Y, right/10, inverted);
drawdigit(DISPLAY_M1_X, DISPLAY_TIME_Y, right % 10, inverted);
- } else if (score_mode == SCORE_MODE_DOW) {
+ }
+#ifdef OPTION_DOW_DATELONG
+ else if (score_mode == SCORE_MODE_DOW) {
uint8_t dow = dotw(date_m, date_d, date_y);
draw7seg(DISPLAY_H10_X, DISPLAY_TIME_Y, 0x00 , inverted);
drawdigit(DISPLAY_H1_X, DISPLAY_TIME_Y, pgm_read_byte(DOWText + (dow*3) + 0), inverted);
@@ -91,7 +96,9 @@ void drawdisplay(void) {
draw7seg(DISPLAY_H1_X, DISPLAY_TIME_Y, 0x00 , inverted);
drawdigit(DISPLAY_M10_X, DISPLAY_TIME_Y, date_d/10, inverted);
drawdigit(DISPLAY_M1_X, DISPLAY_TIME_Y, date_d % 10, inverted);
- } else if ((score_mode == SCORE_MODE_TIME) || (score_mode == SCORE_MODE_ALARM)) {
+ }
+#endif
+ else if ((score_mode == SCORE_MODE_TIME) || (score_mode == SCORE_MODE_ALARM)) {
// draw time or alarm
uint8_t left, right;
if (score_mode == SCORE_MODE_ALARM) {
@@ -207,21 +214,6 @@ void drawhseg(uint8_t x, uint8_t y, uint8_t inverted) {
glcdFillRectangle(x+HSEGMENT_W-1, y+2, 1, HSEGMENT_H - 4, ! inverted);
}
-// 8 pixels high
-static unsigned char __attribute__ ((progmem)) BigFont[] = {
- 0xFF, 0x81, 0x81, 0xFF,// 0
- 0x00, 0x00, 0x00, 0xFF,// 1
- 0x9F, 0x91, 0x91, 0xF1,// 2
- 0x91, 0x91, 0x91, 0xFF,// 3
- 0xF0, 0x10, 0x10, 0xFF,// 4
- 0xF1, 0x91, 0x91, 0x9F,// 5
- 0xFF, 0x91, 0x91, 0x9F,// 6
- 0x80, 0x80, 0x80, 0xFF,// 7
- 0xFF, 0x91, 0x91, 0xFF,// 8
- 0xF1, 0x91, 0x91, 0xFF,// 9
- 0x00, 0x00, 0x00, 0x00,// SPACE
-};
-
uint8_t dotw(uint8_t mon, uint8_t day, uint8_t yr)
{
uint16_t month, year;
View
16 firmware/config.c
@@ -73,6 +73,7 @@ void display_menu(void) {
screenmutex--;
}
+#ifdef OPTION_DOW_DATELONG
void print_month(uint8_t inverted, uint8_t month) {
switch(month)
{
@@ -141,6 +142,7 @@ void print_dow(uint8_t inverted, uint8_t mon, uint8_t day, uint8_t yr) {
}
}
+#endif
void print_date(uint8_t month, uint8_t day, uint8_t year, uint8_t mode) {
glcdSetAddress(MENU_INDENT, 3);
@@ -157,7 +159,9 @@ void print_date(uint8_t month, uint8_t day, uint8_t year, uint8_t mode) {
glcdWriteChar('/', NORMAL);
printnumber(month, (mode == SET_MONTH)?INVERTED:NORMAL);
glcdWriteChar('/', NORMAL);
- } else if ( region == DOW_REGION_US) {
+ }
+#ifdef OPTION_DOW_DATELONG
+ else if ( region == DOW_REGION_US) {
glcdWriteChar(' ', NORMAL);
print_dow(NORMAL,month,day,year);
printnumber(month, (mode == SET_MONTH)?INVERTED:NORMAL);
@@ -185,6 +189,7 @@ void print_date(uint8_t month, uint8_t day, uint8_t year, uint8_t mode) {
printnumber(day, (mode == SET_DAY)?INVERTED:NORMAL);
glcdWriteChar(',', NORMAL);
}
+#endif
printnumber(20,(mode == SET_YEAR)?INVERTED:NORMAL);
printnumber(year, (mode == SET_YEAR)?INVERTED:NORMAL);
}
@@ -444,7 +449,9 @@ void print_region_setting(uint8_t inverted) {
glcdPutStr(" EU 12hr", inverted);
} else if ((region == REGION_EU) && (time_format == TIME_24H)){
glcdPutStr(" EU 24hr", inverted);
- } else if ((region == DOW_REGION_US) && (time_format == TIME_12H)) {
+ }
+#ifdef OPTION_DOW_DATELONG
+ else if ((region == DOW_REGION_US) && (time_format == TIME_12H)) {
glcdPutStr(" US 12hr DOW", inverted);
} else if ((region == DOW_REGION_US) && (time_format == TIME_24H)) {
glcdPutStr(" US 24hr DOW", inverted);
@@ -461,6 +468,7 @@ void print_region_setting(uint8_t inverted) {
} else if ((region == DATELONG_DOW) && (time_format == TIME_24H)){
glcdPutStr("24h LONG DOW", inverted);
}
+#endif
}
void set_region(void) {
@@ -531,7 +539,11 @@ void set_region(void) {
if (mode == SET_REG) {
if(time_format) {
region++;
+#ifdef OPTION_DOW_DATELONG
if(region > DATELONG_DOW)
+#else
+ if(region > REGION_EU)
+#endif
region = 0;
time_format = !time_format;
} else {
View
2,394 firmware/monochron.hex
1,157 additions, 1,237 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
28 firmware/ratt.c
@@ -71,15 +71,23 @@ SIGNAL(TIMER0_COMPA_vect) {
}
void init_eeprom(void) { //Set eeprom to a default state.
+#ifndef OPTION_DOW_DATELONG
if(eeprom_read_byte((uint8_t *)EE_INIT) != EE_INITIALIZED) {
+#else
+ if(eeprom_read_byte((uint8_t *)EE_INIT) != (EE_INITIALIZED-1)) {
+#endif
eeprom_write_byte((uint8_t *)EE_ALARM_HOUR, 8);
eeprom_write_byte((uint8_t *)EE_ALARM_MIN, 0);
eeprom_write_byte((uint8_t *)EE_BRIGHT, OCR2A_VALUE);
eeprom_write_byte((uint8_t *)EE_VOLUME, 1);
eeprom_write_byte((uint8_t *)EE_REGION, REGION_US);
eeprom_write_byte((uint8_t *)EE_TIME_FORMAT, TIME_12H);
eeprom_write_byte((uint8_t *)EE_SNOOZE, 10);
+#ifndef OPTION_DOW_DATELONG
eeprom_write_byte((uint8_t *)EE_INIT, EE_INITIALIZED);
+#else
+ eeprom_write_byte((uint8_t *)EE_INIT, EE_INITIALIZED-1);
+#endif
}
}
@@ -158,24 +166,26 @@ int main(void) {
just_pressed = 0;
setsnooze();
}
- if(display_date==1 && !score_mode_timeout)
+
+ if(display_date==3 && !score_mode_timeout)
{
- display_date=4;
- score_mode = SCORE_MODE_DATELONG_MON;
+ display_date=0;
+ score_mode = SCORE_MODE_YEAR;
score_mode_timeout = 3;
//drawdisplay();
}
+#ifdef OPTION_DOW_DATELONG
else if(display_date==2 && !score_mode_timeout)
{
display_date=3;
score_mode = SCORE_MODE_DATE;
score_mode_timeout = 3;
//drawdisplay();
}
- else if(display_date==3 && !score_mode_timeout)
+ else if(display_date==1 && !score_mode_timeout)
{
- display_date=0;
- score_mode = SCORE_MODE_YEAR;
+ display_date=4;
+ score_mode = SCORE_MODE_DATELONG_MON;
score_mode_timeout = 3;
//drawdisplay();
}
@@ -185,6 +195,8 @@ int main(void) {
score_mode = SCORE_MODE_DATELONG_DAY;
score_mode_timeout = 3;
}
+#endif
+
/*if(display_date && !score_mode_timeout)
{
if(last_score_mode == SCORE_MODE_DATELONG)
@@ -223,9 +235,12 @@ int main(void) {
//This could potentially make you late for work, and had to be fixed.
if (just_pressed & 0x6) {
just_pressed = 0;
+#ifdef OPTION_DOW_DATELONG
if((region == REGION_US) || (region == REGION_EU)) {
+#endif
display_date = 3;
score_mode = SCORE_MODE_DATE;
+#ifdef OPTION_DOW_DATELONG
}
else if ((region == DOW_REGION_US) || (region == DOW_REGION_EU)) {
display_date = 2;
@@ -239,6 +254,7 @@ int main(void) {
display_date = 1;
score_mode = SCORE_MODE_DOW;
}
+#endif
score_mode_timeout = 3;
//drawdisplay();
}
View
4 firmware/ratt.h
@@ -8,6 +8,10 @@
//BACKLIGHT_ADJUST - Allows software control of backlight, assuming you mounted your 100ohm resistor in R2'.
#define BACKLIGHT_ADJUST 1
+//OPTION_DOW_DATELONG - Allows showing Day of Week, and Longer format Dates,
+//Like " sat","0807","2010", or " aug"," 07","2010" or " sat"," aug"," 07","2010".
+//#define OPTION_DOW_DATELONG 1
+
// This is a tradeoff between sluggish and too fast to see
#define MAX_BALL_SPEED 5 // note this is in vector arith.
#define ball_radius 2 // in pixels

0 comments on commit a838204

Please sign in to comment.