diff --git a/src/main.c b/src/main.c index ac8f297..0262cd1 100644 --- a/src/main.c +++ b/src/main.c @@ -15,12 +15,20 @@ typedef enum { DTYPE_HUMIDITY = 3, /**< Humidity */ DTYPE_ALTITUDE = 4, /**< Altitude */ DTYPE_DNE = 5, /**< Data type does not exist */ + DTYPE_ACCELERATON = 6, /**< Linear acceleration*/ + DTYPE_VELOCITY = 7, /**< Angular velocity*/ } Dtype; /** String representation of the possible data types. */ const char *DTYPES[] = { - [DTYPE_TEMPERATURE] = "Temperature", [DTYPE_TIME] = "Time", [DTYPE_PRESSURE] = "Pressure", [DTYPE_DNE] = "", - [DTYPE_ALTITUDE] = "Altitude", [DTYPE_HUMIDITY] = "Humidity", + [DTYPE_TEMPERATURE] = "Temperature", + [DTYPE_TIME] = "Time", + [DTYPE_PRESSURE] = "Pressure", + [DTYPE_DNE] = "", + [DTYPE_ALTITUDE] = "Altitude", + [DTYPE_HUMIDITY] = "Humidity", + [DTYPE_ACCELERATON] = "Linear acceleration", + [DTYPE_VELOCITY] = "Angular velocity", }; /** The size of the buffer for reading sensor data input. */ @@ -158,6 +166,21 @@ int main(int argc, char **argv) { altitude_db_init((AltitudeDB *)packet_pos, last_time, 1000 * strtod(strtok(NULL, ":"), NULL)); break; + case DTYPE_ACCELERATON: + just_added_block_size = sizeof(AccelerationDB); + add_block_header(DATA_ACCEL, just_added_block_size); + acceleration_db_init((AccelerationDB *)packet_pos, last_time, strtod(strtok(NULL, ","), NULL) * 100, + strtod(strtok(NULL, ","), NULL) * 100, strtod(strtok(NULL, ","), NULL) * 100); + break; + + case DTYPE_VELOCITY: + just_added_block_size = sizeof(AngularVelocityDB); + add_block_header(DATA_ANGULAR_VEL, just_added_block_size); + angular_velocity_db_init((AngularVelocityDB *)packet_pos, last_time, + strtod(strtok(NULL, ","), NULL) * 10, strtod(strtok(NULL, ","), NULL) * 10, + strtod(strtok(NULL, ","), NULL) * 10); + break; + default: fprintf(stderr, "Unknown input data type: %s\n", dtype_str); continue; // Skip to next iteration without storing block