/** FAT Fs structure to hold a FAT file handle for the log data write destination. */\r
FIL TempLogFile;\r
\r
-/** Counter to count the number of 10 millisecond tick that has elapsed since the last sample */\r
+/** Counter to count the number of 10 millisecond ticks that has elapsed since the last sample */\r
uint16_t CurrentLogTick;\r
\r
\r
if (CurrentLogTick++ != LOG_INTERVAL_10MS)\r
return;\r
\r
+ uint8_t LEDMask = LEDs_GetLEDs();\r
+\r
+ LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
+\r
CurrentLogTick = 0;\r
\r
if (USB_DeviceState == DEVICE_STATE_Unattached)\r
f_printf(&TempLogFile, "%d Degrees\r\n", Temperature_GetTemperature());\r
f_sync(&TempLogFile);\r
}\r
+ \r
+ LEDs_SetAllLEDs(LEDMask);\r
}\r
\r
\r
f_mount(0, &DiskFATState);\r
f_open(&TempLogFile, LOG_FILENAME, FA_OPEN_ALWAYS | FA_WRITE);\r
f_lseek(&TempLogFile, TempLogFile.fsize);\r
-\r
- /* Write out the log seperator line */\r
f_printf(&TempLogFile, "===========================\r\n");\r
- Temperature_GetTemperature(); // Discard first temperature reading to ensure accuracy\r
-\r
+ \r
+ /* Discard the first sample from the temperature sensor, as it is generally incorrect */\r
+ uint8_t Dummy = Temperature_GetTemperature();\r
+ (void)Dummy;\r
+ \r
for (;;)\r
{\r
MS_Device_USBTask(&Disk_MS_Interface);\r
\r
/* 10ms interval timer configuration */\r
OCR1A = (((F_CPU / 1024) / 100) - 1);\r
- TCCR1A = (1 << WGM01); // CTC mode\r
- TCCR1B = (1 << CS12) | (1 << CS10); // Fcpu/1024 speed\r
+ TCCR1B = (1 << WGM12) | (1 << CS12) | (1 << CS10); // CTC mode, Fcpu/1024 speed\r
TIMSK1 = (1 << OCIE1A);\r
\r
/* Clear Dataflash sector protections, if enabled */\r
f_mount(0, &DiskFATState);\r
f_open(&TempLogFile, LOG_FILENAME, FA_OPEN_ALWAYS | FA_WRITE);\r
f_lseek(&TempLogFile, TempLogFile.fsize);\r
+ f_printf(&TempLogFile, "===========================\r\n");\r
}\r
\r
/** Event handler for the library USB Configuration Changed event. */\r