|
|
|
|
@ -2273,13 +2273,9 @@ float toAprsFormat(float input) {
|
|
|
|
|
int get_payload_serial(int debug_camera) {
|
|
|
|
|
|
|
|
|
|
#ifdef OLD_STEM_PAYLOAD
|
|
|
|
|
if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600
|
|
|
|
|
if ((uart_fd = serialOpen("/dev/ttyAMA0", 115200)) >= 0) { // was 9600
|
|
|
|
|
|
|
|
|
|
// if (payload == ON) { // -55
|
|
|
|
|
if (TRUE) { // -55
|
|
|
|
|
STEMBoardFailure = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char c;
|
|
|
|
|
unsigned int waitTime;
|
|
|
|
|
int i, end, trys = 0;
|
|
|
|
|
@ -2294,11 +2290,11 @@ int get_payload_serial(int debug_camera) {
|
|
|
|
|
end = FALSE;
|
|
|
|
|
// int retry = FALSE;
|
|
|
|
|
while ((millis() < waitTime) && !end) {
|
|
|
|
|
int chars = (char) serialDataAvail(uart_fd);
|
|
|
|
|
int chars = (char)serialDataAvail(uart_fd);
|
|
|
|
|
while ((chars > 0) && !end) {
|
|
|
|
|
// printf("Chars: %d\ ", chars);
|
|
|
|
|
// printf("Chars: %d\ ", chars);
|
|
|
|
|
chars--;
|
|
|
|
|
c = (char) serialGetchar(uart_fd);
|
|
|
|
|
c = (char)serialGetchar(uart_fd);
|
|
|
|
|
// printf ("%c", c);
|
|
|
|
|
// fflush(stdout);
|
|
|
|
|
if (c != '\n') {
|
|
|
|
|
@ -2314,49 +2310,15 @@ int get_payload_serial(int debug_camera) {
|
|
|
|
|
buffer2[i] = '\0';
|
|
|
|
|
printf(" Response from STEM Payload board: %s\n", buffer2);
|
|
|
|
|
sleep(0.1); // added sleep between loops
|
|
|
|
|
//// } // removed this!
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
if ((buffer2[0] == 'O') && (buffer2[1] == 'K')) // only process if valid payload response
|
|
|
|
|
{
|
|
|
|
|
int count1;
|
|
|
|
|
char * token;
|
|
|
|
|
|
|
|
|
|
const char space[2] = " ";
|
|
|
|
|
token = strtok(sensor_payload, space);
|
|
|
|
|
for (count1 = 0; count1 < 17; count1++) {
|
|
|
|
|
if (token != NULL) {
|
|
|
|
|
sensor[count1] = (float) atof(token);
|
|
|
|
|
#ifdef DEBUG_LOGGING
|
|
|
|
|
// printf("sensor: %f ", sensor[count1]);
|
|
|
|
|
#endif
|
|
|
|
|
token = strtok(NULL, space);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
payload = OFF; // turn off since STEM Payload is not responding
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((buffer2[0] == 'O') && (buffer2[1] == 'K')) {
|
|
|
|
|
for (int count1 = 0; count1 < 17; count1++) {
|
|
|
|
|
if (sensor[count1] < sensor_min[count1])
|
|
|
|
|
sensor_min[count1] = sensor[count1];
|
|
|
|
|
if (sensor[count1] > sensor_max[count1])
|
|
|
|
|
sensor_max[count1] = sensor[count1];
|
|
|
|
|
// printf("Smin %f Smax %f \n", sensor_min[count1], sensor_max[count1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
} else
|
|
|
|
|
printf("Can't open serial to payload");
|
|
|
|
|
|
|
|
|
|
if (payload == ON) {
|
|
|
|
|
// printf("\nSTEM Payload is present!\n");
|
|
|
|
|
// sleep(2); // delay to give payload time to get ready
|
|
|
|
|
return(TRUE);
|
|
|
|
|
}
|
|
|
|
|
if ((buffer2[0] == 'O') && (buffer2[1] == 'K')) // {
|
|
|
|
|
// printf("\nSTEM Payload is present!\n");
|
|
|
|
|
// sleep(2); // delay to give payload time to get ready
|
|
|
|
|
return (TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|