void showHistoryTotal(void){ EEOpen(); uint8_t lengths = EEReadByte(2); history.totalLength = lengths; history.showLength = 255; // This will be wrong till I update the record length uint16_t totalTime = EEReadByte(3) << 8; totalTime += EEReadByte(4); // Creating the times for the history display char lengthStr[4], totalTimeStr[10]; itoa(lengths, lengthStr, 10); timeToString(totalTime, totalTimeStr); u8g_FirstPage(&u8g); u8g_SetDefaultForegroundColor(&u8g); do { u8g_DrawFrame(&u8g, 0, 0, 128, 64); u8g_DrawLine(&u8g, 64, 0, 64, 64); u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, "Lengths"))/2, 5, "Lengths"); u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, lengthStr))/2, 5+20, lengthStr); u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, "Time"))/2, 5, "Time"); u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, totalTimeStr))/2, 5+20, totalTimeStr); } while (u8g_NextPage(&u8g)); }
// needs buffer the size of the part void EEReadPartData( EEDATA *pData ) { WORD wAddress; for ( wAddress=0 ; wAddress<EE_DATA_SIZE ; wAddress++ ) #if WORD_WRITES *(pData+wAddress) = EEReadWord(wAddress); #else *(pData+wAddress) = EEReadByte(wAddress); #endif }
// data buffer must be postpended with 0xFF's from end of file to part size WORD EEVerifyPartData( EEDATA *pData ) { WORD wAddress; for ( wAddress=0 ; wAddress<EE_DATA_SIZE ; wAddress++ ) { #if WORD_WRITES if ( EEReadWord(wAddress) != *(pData+wAddress) ) #else if ( EEReadByte(wAddress) != (BYTE)*(pData+wAddress) ) #endif return(MAKEWORD(EEOP_BADVERIFY,(LOBYTE(wAddress)))); } return(EEOP_NOERR); }
void showLength(void){ uint8_t curTime = EEReadByte(5+history.showLength); char lengthStr[4], timeStr[9]; itoa(history.showLength+1, lengthStr, 10); timeToString(curTime, timeStr); u8g_FirstPage(&u8g); u8g_SetDefaultForegroundColor(&u8g); do { u8g_DrawFrame(&u8g, 0, 0, 128, 64); u8g_DrawLine(&u8g, 64, 0, 64, 64); u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, "Length"))/2, 5, "Length"); u8g_DrawStr(&u8g, (64 - u8g_GetStrWidth(&u8g, lengthStr))/2, 5+20, lengthStr); u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, "Time"))/2, 5, "Time"); u8g_DrawStr(&u8g, 64+(64 - u8g_GetStrWidth(&u8g, timeStr))/2, 5+20, timeStr); } while (u8g_NextPage(&u8g)); }