@@ -221,14 +221,7 @@ GetValueFromSensorsEventOrientation(wippersnapper_sensor_SensorType sensor_type,
221221*/
222222bool GetValueFromSensorsEventBoolean (
223223 wippersnapper_sensor_SensorType sensor_type, sensors_event_t *event) {
224- bool value = false ;
225- WS_DEBUG_PRINTLN (" [i2c] Getting boolean event value..." );
226- WS_DEBUG_PRINT (" [i2c] Event data[0]: " );
227- WS_DEBUG_PRINTLN (event->data [0 ]);
228- value = event->data [0 ] > 0 .0f ;
229- WS_DEBUG_PRINT (" [i2c] Boolean value (x>0): " );
230- WS_DEBUG_PRINTLN (value);
231- return value;
224+ return event->data [0 ] > 0 .0f ;
232225}
233226
234227/* !
@@ -477,6 +470,9 @@ bool I2cModel::AddI2cDeviceSensorEvent(
477470 _msg_i2c_device_event
478471 .i2c_device_events [_msg_i2c_device_event.i2c_device_events_count ]
479472 .value .vector_value .z = value_vect.z ;
473+ _msg_i2c_device_event
474+ .i2c_device_events [_msg_i2c_device_event.i2c_device_events_count ]
475+ .which_value = wippersnapper_sensor_SensorEvent_vector_value_tag;
480476 } else if (sensor_type ==
481477 wippersnapper_sensor_SensorType_SENSOR_TYPE_ORIENTATION ||
482478 sensor_type ==
@@ -492,18 +488,27 @@ bool I2cModel::AddI2cDeviceSensorEvent(
492488 _msg_i2c_device_event
493489 .i2c_device_events [_msg_i2c_device_event.i2c_device_events_count ]
494490 .value .orientation_value .pitch = value_vect.pitch ;
491+ _msg_i2c_device_event
492+ .i2c_device_events [_msg_i2c_device_event.i2c_device_events_count ]
493+ .which_value = wippersnapper_sensor_SensorEvent_orientation_value_tag;
495494 // TODO: Add color RGB(A) vector support
496495 } else if (sensor_type ==
497496 wippersnapper_sensor_SensorType_SENSOR_TYPE_BOOLEAN) {
498497 bool value = GetValueFromSensorsEventBoolean (sensor_type, &event);
499498 _msg_i2c_device_event
500499 .i2c_device_events [_msg_i2c_device_event.i2c_device_events_count ]
501500 .value .bool_value = value;
501+ _msg_i2c_device_event
502+ .i2c_device_events [_msg_i2c_device_event.i2c_device_events_count ]
503+ .which_value = wippersnapper_sensor_SensorEvent_bool_value_tag;
502504 } else {
503505 float value = GetValueFromSensorsEvent (sensor_type, &event);
504506 _msg_i2c_device_event
505507 .i2c_device_events [_msg_i2c_device_event.i2c_device_events_count ]
506508 .value .float_value = value;
509+ _msg_i2c_device_event
510+ .i2c_device_events [_msg_i2c_device_event.i2c_device_events_count ]
511+ .which_value = wippersnapper_sensor_SensorEvent_float_value_tag;
507512 }
508513
509514 _msg_i2c_device_event.i2c_device_events_count ++;
0 commit comments