Procházet zdrojové kódy

- temperature on display,
- logs in separate directories,
- elevation on display w/o fractional part

pblac před 2 roky
rodič
revize
2bbea5a645
6 změnil soubory, kde provedl 43 přidání a 7 odebrání
  1. 9 3
      soft/display.c
  2. 1 0
      soft/display.h
  3. 1 1
      soft/ffconf.h
  4. 25 3
      soft/main.c
  5. 6 0
      soft/main.h
  6. 1 0
      soft/working_modes.c

+ 9 - 3
soft/display.c

@@ -138,15 +138,20 @@ void disp_func_coord(__attribute__ ((unused)) unsigned char changed) {
 }
 
 void disp_func_voltage(__attribute__ ((unused)) unsigned char changed) {
-	strcpy_P(disp.line1, PSTR("Batt. voltage"));
-	xsprintf(disp.line2, PSTR("%1.2fV"), System.bat_volt);
+	strcpy_P(disp.line1, PSTR("Batt.voltage"));
+	xsprintf(disp.line2, PSTR("%.2f V"), System.bat_volt);
+}
+
+void disp_func_temperature(__attribute__ ((unused)) unsigned char changed) {
+	strcpy_P(disp.line1, PSTR("Temperature"));
+	xsprintf(disp.line2, PSTR("%.1f C"), System.temperature);
 }
 
 void disp_func_ele_sat(__attribute__ ((unused)) unsigned char changed) {
 	if (System.location_valid == LOC_INVALID) {
 		strcpy_P(disp.line1, PSTR("ele = ???"));
 	} else {
-		xsprintf(disp.line1, PSTR("ele = %.1fm"), location.alt);
+		xsprintf(disp.line1, PSTR("ele = %.0f m"), location.alt);
 	}
 	xsprintf(disp.line2, PSTR("%d satelit"), System.satellites_used);
 }
@@ -170,6 +175,7 @@ void (*__flash const disp_funcs[])(unsigned char) = {
 	[DISPLAY_STATE_ELE_SAT] = disp_func_ele_sat,
 	[DISPLAY_STATE_VOLTAGE] = disp_func_voltage,
 	[DISPLAY_STATE_MAIN_MENU] = disp_func_main_menu,
+	[DISPLAY_STATE_TEMPERATURE] = disp_func_temperature,
 };
 
 void display_refresh(unsigned char newstate) {

+ 1 - 0
soft/display.h

@@ -13,6 +13,7 @@
 #define DISPLAY_STATE_ELE_SAT	10
 #define DISPLAY_STATE_VOLTAGE	11
 #define DISPLAY_STATE_MAIN_MENU	12
+#define DISPLAY_STATE_TEMPERATURE 13
 
 void display_refresh(unsigned char newstate);
 void display_state(unsigned char newstate);

+ 1 - 1
soft/ffconf.h

@@ -15,7 +15,7 @@
 /  and optional writing functions as well. */
 
 
-#define FF_FS_MINIMIZE	1
+#define FF_FS_MINIMIZE	0
 /* This option defines minimization level to remove some basic API functions.
 /
 /   0: Basic functions are fully enabled.

+ 25 - 3
soft/main.c

@@ -330,6 +330,28 @@ int main (void)
 			System.status = STATUS_DISK_ERROR;
 			continue;
 		}
+
+		res = f_mkdir(DIR_PATH_GPX);
+		if (res != FR_OK && res != FR_EXIST) {
+			xprintf(PSTR("FS dir error %u\r\n"), res);
+			System.status = STATUS_DISK_ERROR;
+			continue;
+		}
+
+		res = f_mkdir(DIR_PATH_SYSLOG);
+		if (res != FR_OK && res != FR_EXIST) {
+			xprintf(PSTR("FS dir error %u\r\n"), res);
+			System.status = STATUS_DISK_ERROR;
+			continue;
+		}
+
+		res = f_mkdir(DIR_PATH_NMEA);
+		if (res != FR_OK && res != FR_EXIST) {
+			xprintf(PSTR("FS dir error %u\r\n"), res);
+			System.status = STATUS_DISK_ERROR;
+			continue;
+		}
+
 		System.status = STATUS_NO_GPS;
 		xputs(PSTR("FS Ok\r\n"));
 		display_state(DISPLAY_STATE_CARD_OK);
@@ -410,7 +432,7 @@ int main (void)
 					}
 					ptr++;
 				}
-				xsprintf(Line, PSTR("%s-NMEA.LOG"), time);
+				xsprintf(Line, PSTR("%s/%s-NMEA.LOG"), DIR_PATH_NMEA, time);
 				xprintf(__open_msg, Line);
 				if (f_open(&gps_log, Line, FA_WRITE | FA_OPEN_ALWAYS)		/* Open log file */
 					|| f_lseek(&gps_log, f_size(&gps_log)) 					/* Append mode */
@@ -421,7 +443,7 @@ int main (void)
 				}
 				wdt_reset();
 
-				xsprintf(Line, PSTR("%s.GPX"), time);
+				xsprintf(Line, PSTR("%s/%s.GPX"), DIR_PATH_GPX, time);
 				xprintf(__open_msg, Line);
 				if (f_open(&gpx_file, Line, FA_WRITE | FA_OPEN_ALWAYS)		/* Open log file */
 					|| f_lseek(&gpx_file, f_size(&gpx_file)) 				/* Append mode */
@@ -433,7 +455,7 @@ int main (void)
 				}
 				wdt_reset();
 
-				xsprintf(Line, PSTR("%s-SYSTEM.LOG"), time);
+				xsprintf(Line, PSTR("%s/%s-SYSTEM.LOG"), DIR_PATH_SYSLOG, time);
 				xprintf(__open_msg, Line);
 				if (f_open(&system_log, Line, FA_WRITE | FA_OPEN_ALWAYS)	/* Open log file */
 					|| f_lseek(&system_log, f_size(&system_log)) 			/* Append mode */

+ 6 - 0
soft/main.h

@@ -17,6 +17,12 @@
 #define	VI_LVH		3.4			/* Recharge threshold [volt] */
 #define	VI_MULT		(3.3 / 6.6 / 2.495 * 1024)
 
+/* directories paths */
+
+#define DIR_PATH_GPX "GPX"
+#define DIR_PATH_SYSLOG "SYSLOG"
+#define DIR_PATH_NMEA "NMEA"
+
 /* pin definitions */
 
 #define BUZZER_PORT		PORTA

+ 1 - 0
soft/working_modes.c

@@ -11,6 +11,7 @@ __flash const unsigned char main_display_modes[] = {
 	DISPLAY_STATE_COORD,
 	DISPLAY_STATE_ELE_SAT,
 	DISPLAY_STATE_VOLTAGE,
+	DISPLAY_STATE_TEMPERATURE,
 };
 
 void change_display_mode(signed char dir) {