changed to sprintf

master-fsk-cw
Alan Johnston 2 weeks ago committed by GitHub
parent fed7b22463
commit 49ef97e8ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -866,28 +866,35 @@ tempP = rnd_float(-25, -15); // simulated payload parameters
*/ */
if (sim_mode && (failureMode != FAIL_PAYLOAD) && !payload) { if (sim_mode && (failureMode != FAIL_PAYLOAD) && !payload) {
char str_tmp[10];
printf("Generating simulated payload telemetry\n"); printf("Generating simulated payload telemetry\n");
if (atmosphere == 0) { if (atmosphere == 0) {
sensor[PRES] = 0; sensor[PRES] = 0;
strcpy(sensor_string[PRES], "0.0"); strcpy(sensor_string[PRES], "0.0");
sensor[ALT] = altSP; sensor[ALT] = altSP;
strcpy(sensor_string[ALT], &itoa(altSP)); sprintf(str_tmp, "%5.0f", altSP);
strcpy(sensor_string[ALT], str_tmp);
print("Alt: %s\n", sensor_string[ALT]); print("Alt: %s\n", sensor_string[ALT]);
sensor[HUMI] = 0; sensor[HUMI] = 0;
strcpy(sensor_string[HUMI], "0.0"); strcpy(sensor_string[HUMI], "0.0");
sensor[TEMP] = &itoa(tempP + 80 * (1 - eclipse)); sensor[TEMP] = tempP + 80 * (1 - eclipse);
strcpy(sensor_string[TEMP], &itoa(tempP + 80 * (1 - eclipse))); sprintf(char_tmp, "%4.1f", sensor[TEMP]);
strcpy(sensor_string[ALT], str_tmp);
print("Temp: %s\n", sensor_string[TEMP]); print("Temp: %s\n", sensor_string[TEMP]);
} else { } else {
sensor[PRES] = presP; sensor[PRES] = presP;
strcpy(sensor_string[PRES], atoi(presP)); sprintf(str_tmp, "%5.0f", presP);
strcpy(sensor_string[PRES], str_tmp);
print("Pres: %s\n", sensor_string[PRES]); print("Pres: %s\n", sensor_string[PRES]);
sensor[ALT] = altGP; sensor[ALT] = altGP;
strcpy(sensor_string[ALT], atoi(altGP)); sprintf(str_tmp, "%5.0f", altGP);
strcpy(sensor_string[ALT], str_tmp);
sensor[HUMI] = humiP; sensor[HUMI] = humiP;
strcpy(sensor_string[HUMI], atoi(humiP)); sprintf(str_tmp, "%3.0f", humiP);
sensor[TEMP] = &itoa(tempP + 80 * (1 - eclipse)); strcpy(sensor_string[HUMI], str_tmp);
strcpy(sensor_string[TEMP], &itoa(tempP + 80 * (1 - eclipse))); sensor[TEMP] = tempP + 80 * (1 - eclipse);
sprintf(str_tmp, "%3.0f",sensor[TEMP]);
strcpy(sensor_string[TEMP], str_tmp);
print("Temp: %s\n", sensor_string[TEMP]); print("Temp: %s\n", sensor_string[TEMP]);
} }
char sensor_number[20]; char sensor_number[20];

Loading…
Cancel
Save

Powered by TurnKey Linux.