main/setup.c

changeset 54
7b134c27fadb
parent 49
4ec04c6f1551
child 82
7d17e2cb31a8
--- a/main/setup.c	Sun May 19 21:05:07 2019 +0200
+++ b/main/setup.c	Mon Jul 01 23:15:49 2019 +0200
@@ -31,34 +31,34 @@
     switch (Main_Screen) {
 
 	case MAIN_TOOLS_SETUP:
-			TopMessage("Setup menu");
-			Buttons_Add( 20, 40,120, 40, "Config", 0);
-			Buttons_Add(180, 40,120, 40, "Apparatuur", 1);
-			Buttons_Add( 20,120,120, 40, "WiFi", 2);
-			Buttons_Add(180,120,120, 40, "Calibratie", 3);
-			Buttons_Add(130, 200, 60, 40, "Ok", 4);
+			TopMessage((char *)"Setup menu");
+			Buttons_Add( 20, 40,120, 40, (char *)"Config", 0);
+			Buttons_Add(180, 40,120, 40, (char *)"Apparatuur", 1);
+			Buttons_Add( 20,120,120, 40, (char *)"WiFi", 2);
+			Buttons_Add(180,120,120, 40, (char *)"Calibratie", 3);
+			Buttons_Add(130, 200, 60, 40, (char *)"Ok", 4);
 			Buttons[4].dark = true;
 			Buttons_Show();
 			break;
 
 	case MAIN_TOOLS_SETUP_CONFIG:
 			_bg = TFT_BLACK;
-			TopMessage("Configuratie");
+			TopMessage((char *)"Configuratie");
 			TFT_setFont(DEFAULT_FONT, NULL);
-			ShowFloat(2, 28, "Kook temp.", "C", config.BoilTemperature, 2);
-			ShowBool(2, 44, "Vraag mout storten", config.AskAdd);
-			ShowBool(2, 60, "Vraag mout verwijderen", config.AskRemove);
-			ShowBool(2, 76, "Vraag Jodium proef", config.AskIodine);
-			ShowInteger(2, 92, "Jodiumtest wachttijd", " min.", config.IodineTime);
-			ShowText(2, 108, "Hostnaam", config.hostname);
-			ShowText(2, 124, "AP SSID", config.ap_ssid);
-			ShowText(2, 140, "AP pwd", config.ap_pwd);
-			ShowInteger(2, 156, "AP kanaal", NULL, config.ap_channel);
-			ShowBool(2, 172, "AP SSID verborgen", config.ap_ssid_hidden);
-			ShowText(2, 188, "NTP server", config.ntp_server);
+			ShowFloat(2, 28, (char *)"Kook temp.", (char *)"C", config.BoilTemperature, 2);
+			ShowBool(2, 44, (char *)"Vraag mout storten", config.AskAdd);
+			ShowBool(2, 60, (char *)"Vraag mout verwijderen", config.AskRemove);
+			ShowBool(2, 76, (char *)"Vraag Jodium proef", config.AskIodine);
+			ShowInteger(2, 92, (char *)"Jodiumtest wachttijd", (char *)" min.", config.IodineTime);
+			ShowText(2, 108, (char *)"Hostnaam", config.hostname);
+			ShowText(2, 124, (char *)"AP SSID", config.ap_ssid);
+			ShowText(2, 140, (char *)"AP pwd", config.ap_pwd);
+			ShowInteger(2, 156, (char *)"AP kanaal", NULL, config.ap_channel);
+			ShowBool(2, 172, (char *)"AP SSID verborgen", config.ap_ssid_hidden);
+			ShowText(2, 188, (char *)"NTP server", config.ntp_server);
 			Buttons_Clear();
-			Buttons_Add(  0, 210, 45, 30, "Ok"  , 0);
-			Buttons_Add(276, 210, 45, 30, "Ed"  , 1);
+			Buttons_Add(  0, 210, 45, 30, (char *)"Ok"  , 0);
+			Buttons_Add(276, 210, 45, 30, (char *)"Ed"  , 1);
 			Buttons[0].dark = true;
 			Buttons_Show();
 			break;
@@ -67,7 +67,7 @@
 			break;
 
 	case MAIN_TOOLS_SETUP_EQUIPMENT:
-			TopMessage("Apparatuur");
+			TopMessage((char *)"Apparatuur");
 			f = fopen("/spiffs/etc/equipments.conf", "r");
 			dst = (uint8_t*)&equipment;
 			Records = 0;
@@ -140,24 +140,24 @@
 	case MAIN_TOOLS_SETUP_CO_EDIT:
 			dst = (uint8_t*)&config;
 			crc1 = crc32_le(0, dst, sizeof(config));
-			EditFloat("Kook temperatuur", &config.BoilTemperature, 80, 105, 2);
+			EditFloat((char *)"Kook temperatuur", &config.BoilTemperature, 80, 105, 2);
 			// Round to 0.25 degrees
 			config.BoilTemperature = ((int)(config.BoilTemperature * 4)) / 4.0;
-			EditBool("Vraag mout storten", &config.AskAdd);
-			EditBool("Vraag mout verwijderen", &config.AskRemove);
-			EditBool("Vraag Jodium proef", &config.AskIodine);
-			EditUint8("Jodium test wachttijd", &config.IodineTime, 0, 120);
-			EditText("DHCP hostnaam", config.hostname, 31);
-			EditText("AP SSID", config.ap_ssid, 31);
-			EditTextMin("AP password", config.ap_pwd, 40, 8);
-			EditUint8("AP kanaal", &config.ap_channel, 1, 14);
+			EditBool((char *)"Vraag mout storten", &config.AskAdd);
+			EditBool((char *)"Vraag mout verwijderen", &config.AskRemove);
+			EditBool((char *)"Vraag Jodium proef", &config.AskIodine);
+			EditUint8((char *)"Jodium test wachttijd", &config.IodineTime, 0, 120);
+			EditText((char *)"DHCP hostnaam", config.hostname, 31);
+			EditText((char *)"AP SSID", config.ap_ssid, 31);
+			EditTextMin((char *)"AP password", config.ap_pwd, 40, 8);
+			EditUint8((char *)"AP kanaal", &config.ap_channel, 1, 14);
 			bool hidden = config.ap_ssid_hidden;
-			EditBool("AP SSID verborgen", &hidden);
+			EditBool((char *)"AP SSID verborgen", &hidden);
 			config.ap_ssid_hidden = (uint8_t)hidden;
-			EditText("Voorkeur NTP server", config.ntp_server, 31);
+			EditText((char *)"Voorkeur NTP server", config.ntp_server, 31);
 
 			crc2 = crc32_le(0, dst, sizeof(config));
-			if ((crc1 != crc2) && Confirm("Gewijzigd, opslaan?", "Ja", "Nee")) {
+			if ((crc1 != crc2) && Confirm((char *)"Gewijzigd, opslaan?", (char *)"Ja", (char *)"Nee")) {
 			    write_config();
 			} else {
 			    read_config();
@@ -170,48 +170,48 @@
 			    _bg = TFT_BLACK;
 			    TFT_fillScreen(_bg);
 			    TFT_resetclipwin();
-			    TopMessage("Apparatuur");
+			    TopMessage((char *)"Apparatuur");
 			    UpdateRec = false;
 			    read_equipment(CurrentRec);
 			    TFT_setFont(DEFAULT_FONT, NULL);
-			    ShowText(2, 28, "Naam", equipment.Name);
-			    ShowInteger(  2, 44, "Kook vermogen", "%", equipment.BoilPower);
-			    ShowInteger(161, 44, "Maisch verm.", "%", equipment.MashPower);
-			    ShowInteger(  2, 60, "Pomp cyclus", "m", equipment.PumpCycle);
-			    ShowInteger(161, 60, "Pomp rust", "m", equipment.PumpRest);
-			    ShowBool(  2,  76, "Pomp opwarmen", equipment.PumpPreMash);
-			    ShowBool(161,  76, "Pomp maischen", equipment.PumpOnMash);
-			    ShowBool(  2,  92, "Pomp uitmaischen", equipment.PumpMashOut);
-			    ShowBool(161,  92, "Pomp bij koken", equipment.PumpOnBoil);
-			    ShowInteger(2, 108, "Pomp maxtemp.", "C", equipment.PumpMaxTemp);
-			    ShowBool(161, 108, "PID bij mout weg", equipment.PIDPipe);
+			    ShowText(2, 28, (char *)"Naam", equipment.Name);
+			    ShowInteger(  2, 44, (char *)"Kook vermogen", (char *)"%", equipment.BoilPower);
+			    ShowInteger(161, 44, (char *)"Maisch verm.", (char *)"%", equipment.MashPower);
+			    ShowInteger(  2, 60, (char *)"Pomp cyclus", (char *)"m", equipment.PumpCycle);
+			    ShowInteger(161, 60, (char *)"Pomp rust", (char *)"m", equipment.PumpRest);
+			    ShowBool(  2,  76, (char *)"Pomp opwarmen", equipment.PumpPreMash);
+			    ShowBool(161,  76, (char *)"Pomp maischen", equipment.PumpOnMash);
+			    ShowBool(  2,  92, (char *)"Pomp uitmaischen", equipment.PumpMashOut);
+			    ShowBool(161,  92, (char *)"Pomp bij koken", equipment.PumpOnBoil);
+			    ShowInteger(2, 108, (char *)"Pomp maxtemp.", (char *)"C", equipment.PumpMaxTemp);
+			    ShowBool(161, 108, (char *)"PID bij mout weg", equipment.PIDPipe);
 			    ShowSSR2(2, 124, equipment.SSR2);
-			    ShowFloat(161, 124, "Spoelwater", NULL, equipment.TempHLT, 2);
-			    ShowDouble(2, 140, "PID P", NULL, equipment.PID_kP, 3);
-			    ShowBool(161, 140, "PID klassiek", equipment.PID_POn);
-			    ShowDouble(2, 156, "PID I", NULL, equipment.PID_kI, 3);
-			    ShowInteger(161, 156, "Sample tijd", "mS", equipment.SampleTime);
-			    ShowDouble(2, 172, "PID D", NULL, equipment.PID_kD, 3);
+			    ShowFloat(161, 124, (char *)"Spoelwater", NULL, equipment.TempHLT, 2);
+			    ShowDouble(2, 140, (char *)"PID P", NULL, equipment.PID_kP, 3);
+			    ShowBool(161, 140, (char *)"PID klassiek", equipment.PID_POn);
+			    ShowDouble(2, 156, (char *)"PID I", NULL, equipment.PID_kI, 3);
+			    ShowInteger(161, 156, (char *)"Sample tijd", (char *)"mS", equipment.SampleTime);
+			    ShowDouble(2, 172, (char *)"PID D", NULL, equipment.PID_kD, 3);
 			    Buttons_Clear();
-			    Buttons_Add(  0, 210, 45, 30, "Ok"  , 0);
-			    Buttons_Add( 46, 210, 45, 30, "+"   , 1);
+			    Buttons_Add(  0, 210, 45, 30, (char *)"Ok"  , 0);
+			    Buttons_Add( 46, 210, 45, 30, (char *)"+"   , 1);
 			    if (CurrentRec != config.EquipmentRec)
-			        Buttons_Add( 92, 210, 45, 30, "-", 2);
+			        Buttons_Add( 92, 210, 45, 30, (char *)"-", 2);
 			    else
-				Buttons_Add( 92, 210, 45, 30, ""    , 2);
+				Buttons_Add( 92, 210, 45, 30, (char *)""    , 2);
 			    if (CurrentRec > 1)
-			    	Buttons_Add(138, 210, 45, 30, "<", 3);
+			    	Buttons_Add(138, 210, 45, 30, (char *)"<", 3);
 			    else
-				Buttons_Add(138, 210, 45, 30, "", 3);
+				Buttons_Add(138, 210, 45, 30, (char *)"", 3);
 			    if (CurrentRec < Records)
-			    	Buttons_Add(184, 210, 45, 30, ">", 4);
+			    	Buttons_Add(184, 210, 45, 30, (char *)">", 4);
 			    else
-				Buttons_Add(184, 210, 45, 30, "", 4);
+				Buttons_Add(184, 210, 45, 30, (char *)"", 4);
 			    if (CurrentRec != config.EquipmentRec)
-			    	Buttons_Add(230, 210, 45, 30, "Std", 5);
+			    	Buttons_Add(230, 210, 45, 30, (char *)"Std", 5);
 			    else
-				Buttons_Add(230, 210, 45, 30, "", 5);
-			    Buttons_Add(276, 210, 45, 30, "Ed"  , 6);
+				Buttons_Add(230, 210, 45, 30, (char *)"", 5);
+			    Buttons_Add(276, 210, 45, 30, (char *)"Ed"  , 6);
 			    Buttons[0].dark = true;
 			    Buttons_Show();
 			}
@@ -286,31 +286,31 @@
 	case MAIN_TOOLS_SETUP_EQ_EDIT:
 			dst = (uint8_t*)&equipment;
 			crc1 = crc32_le(0, dst, sizeof(equipment));
-			EditText("Naam", equipment.Name, 31);
-			EditInt("Kook vermogen in %", &equipment.BoilPower, 0, 100);
-			EditInt("Maisch vermogen in %", &equipment.MashPower, 0, 100);
-			EditInt("Pomp cyclus minuten", &equipment.PumpCycle, 5, 15);
-			EditInt("Pomp rust minuten", &equipment.PumpRest, 0, 5);
-			EditBool("Pomp bij opwarmen", &equipment.PumpPreMash);
-			EditBool("Pomp bij maischen", &equipment.PumpOnMash);
-			EditBool("Pomp bij uitmaischen", &equipment.PumpMashOut);
-			EditBool("Pomp tijdens koken", &equipment.PumpOnBoil);
-			EditInt("Pomp max. temperatuur", &equipment.PumpMaxTemp, 60, 105);
-			EditBool("PID by mout verwijderen", &equipment.PIDPipe);
+			EditText((char *)"Naam", equipment.Name, 31);
+			EditInt((char *)"Kook vermogen in %", &equipment.BoilPower, 0, 100);
+			EditInt((char *)"Maisch vermogen in %", &equipment.MashPower, 0, 100);
+			EditInt((char *)"Pomp cyclus minuten", &equipment.PumpCycle, 5, 15);
+			EditInt((char *)"Pomp rust minuten", &equipment.PumpRest, 0, 5);
+			EditBool((char *)"Pomp bij opwarmen", &equipment.PumpPreMash);
+			EditBool((char *)"Pomp bij maischen", &equipment.PumpOnMash);
+			EditBool((char *)"Pomp bij uitmaischen", &equipment.PumpMashOut);
+			EditBool((char *)"Pomp tijdens koken", &equipment.PumpOnBoil);
+			EditInt((char *)"Pomp max. temperatuur", &equipment.PumpMaxTemp, 60, 105);
+			EditBool((char *)"PID by mout verwijderen", &equipment.PIDPipe);
 			EditSSR2(&equipment.SSR2);
-			EditFloat("Spoelwater temp", &equipment.TempHLT, 75, 98, 2);
+			EditFloat((char *)"Spoelwater temp", &equipment.TempHLT, 75, 98, 2);
 			// Round to 0.25 values.
 			equipment.TempHLT = ((int)(equipment.TempHLT * 4)) / 4.0;
-			EditBool("PID klassiek", &equipment.PID_POn);
-			EditDouble("PID P",  &equipment.PID_kP, 20, 2000, 3);
-			EditDouble("PID I",  &equipment.PID_kI, 0, 100, 3);
-			EditDouble("PID D",  &equipment.PID_kD, 0, 50000, 3);
-			EditInt("Sample tijd in mS", &equipment.SampleTime, 1000, 20000);
+			EditBool((char *)"PID klassiek", &equipment.PID_POn);
+			EditDouble((char *)"PID P",  &equipment.PID_kP, 20, 2000, 3);
+			EditDouble((char *)"PID I",  &equipment.PID_kI, 0, 100, 3);
+			EditDouble((char *)"PID D",  &equipment.PID_kD, 0, 50000, 3);
+			EditInt((char *)"Sample tijd in mS", &equipment.SampleTime, 1000, 20000);
 			// Round to 250 mSec units.
 			equipment.SampleTime = ((int)(equipment.SampleTime / 250)) * 250;
 
 			crc2 = crc32_le(0, dst, sizeof(equipment));
-			if ((crc1 != crc2) && Confirm("Gewijzigd, opslaan?", "Ja", "Nee")) {
+			if ((crc1 != crc2) && Confirm((char *)"Gewijzigd, opslaan?", (char *)"Ja", (char *)"Nee")) {
 			    write_equipment(equipment.Record);
 			}
 			Main_Screen = MAIN_TOOLS_SETUP_EQUIPMENT;

mercurial