I have never found myself looking to my watch for the year, but I do

often refer to my watch for the day of the week.  So I modified the TI function 
that displays the year to display the day of the week instead.
The function to set the year still works.  The day of the week is being 
displayed as a number Sunday = 0, Monday-Friday = 1-5, Saturday=6.  It
would be simple to display the day as text, but I stopped here.

In logic/date.c
In function display_date
In section // Convert year to string
Near line #333
between str = itoa(sDate.year, 4, 0);
and display_chars(switch_seg(line, LCD_SEG_L1_3_0, LCD_SEG_L2_3_0), str, 
SEG_ON);
I added my code.  My code begins at //pfs BEGIN and ends at //pfs END in the 
code below


// Convert year to string
    str = itoa(sDate.year, 4, 0);

    //pfs BEGIN replace year display with day of week
    //pfs algorith from http://klausler.com/new-dayofweek.html
    #define BASE_YEAR 1900 // not a leap year, so no need to add 1
    u8 skew;
    skew = (sDate.year - BASE_YEAR)+(sDate.year - BASE_YEAR)/4; //
compute number of leap years since BASE_YEAR
    if ((29 == get_numberOfDays(2, sDate.year))&&  (sDate.month<  3))
      skew -= 1; // if this is a leap year but before February 29
    skew = skew%7;
    skew = (skew + sDate.day)%7; // add day of current month
    //add this month's skew value
    switch(sDate.month) {
      case 5:
        skew += 1;
        break;
      case 8:
        skew += 2;
        break;
      case 2:
      case 3:
      case 11:
        skew += 3;
        break;
      case 6:
        skew += 4;
        break;
      case 9:
      case 12:
        skew += 5;
        break;
      case 4:
      case 7:
        skew += 6;
        break;
      default:  //January and October
        break;
    }
    skew = skew%7;
    str = itoa(skew,4,0);
    // pfs END of day of week addendum

    display_chars(switch_seg(line, LCD_SEG_L1_3_0, LCD_SEG_L2_3_0),
str, SEG_ON);

    // Clear "."
    display_symbol(switch_seg(line, LCD_SEG_L1_DP1, LCD_SEG_L2_DP),
SEG_OFF);




Reply via email to