@@ -466,9 +466,12 @@ void GaleaV4::read_thread ()
466
466
// aux, 5 times smaller sampling rate
467
467
if (((int )b[0 + offset]) % 5 == 0 )
468
468
{
469
- double accel_scale = (double )(0.002 / (pow (2 , 4 )));
470
- double gyro_scale = (double )(0.002 / (pow (2 , 4 ))); // to be confirmed
471
- double magnetometer_scale = (double )(0.002 / (pow (2 , 4 ))); // to be confirmed
469
+ double accel_scale = (double )(8.0 / static_cast <double > (pow (2 , 16 ) - 1 ));
470
+ double gyro_scale = (double )(1000.0 / static_cast <double > (pow (2 , 16 ) - 1 ));
471
+ double magnetometer_scale_xy =
472
+ (double )(2.6 / static_cast <double > (pow (2 , 13 ) - 1 ));
473
+ double magnetometer_scale_z =
474
+ (double )(5.0 / static_cast <double > (pow (2 , 15 ) - 1 ));
472
475
aux_package[board_descr[" auxiliary" ][" package_num_channel" ].get <int > ()] =
473
476
(double )b[0 + offset];
474
477
uint16_t temperature = 0 ;
@@ -501,25 +504,28 @@ void GaleaV4::read_thread ()
501
504
timestamp_device;
502
505
// accel
503
506
aux_package[board_descr[" auxiliary" ][" accel_channels" ][0 ].get <int > ()] =
504
- accel_scale * cast_16bit_to_int32 (b + 96 + offset);
507
+ accel_scale * ( double ) cast_16bit_to_int32_swap_order (b + 96 + offset);
505
508
aux_package[board_descr[" auxiliary" ][" accel_channels" ][1 ].get <int > ()] =
506
- accel_scale * cast_16bit_to_int32 (b + 98 + offset);
509
+ accel_scale * ( double ) cast_16bit_to_int32_swap_order (b + 98 + offset);
507
510
aux_package[board_descr[" auxiliary" ][" accel_channels" ][2 ].get <int > ()] =
508
- accel_scale * cast_16bit_to_int32 (b + 100 + offset);
511
+ accel_scale * ( double ) cast_16bit_to_int32_swap_order (b + 100 + offset);
509
512
// gyro
510
513
aux_package[board_descr[" auxiliary" ][" gyro_channels" ][0 ].get <int > ()] =
511
- gyro_scale * cast_16bit_to_int32 (b + 102 + offset);
514
+ gyro_scale * ( double ) cast_16bit_to_int32_swap_order (b + 102 + offset);
512
515
aux_package[board_descr[" auxiliary" ][" gyro_channels" ][1 ].get <int > ()] =
513
- gyro_scale * cast_16bit_to_int32 (b + 104 + offset);
516
+ gyro_scale * ( double ) cast_16bit_to_int32_swap_order (b + 104 + offset);
514
517
aux_package[board_descr[" auxiliary" ][" gyro_channels" ][2 ].get <int > ()] =
515
- gyro_scale * cast_16bit_to_int32 (b + 106 + offset);
518
+ gyro_scale * ( double ) cast_16bit_to_int32_swap_order (b + 106 + offset);
516
519
// magnetometer
517
520
aux_package[board_descr[" auxiliary" ][" magnetometer_channels" ][0 ].get <int > ()] =
518
- magnetometer_scale * cast_16bit_to_int32 (b + 108 + offset);
521
+ magnetometer_scale_xy *
522
+ (double )cast_13bit_to_int32_swap_order (b + 108 + offset);
519
523
aux_package[board_descr[" auxiliary" ][" magnetometer_channels" ][1 ].get <int > ()] =
520
- magnetometer_scale * cast_16bit_to_int32 (b + 110 + offset);
524
+ magnetometer_scale_xy *
525
+ (double )cast_13bit_to_int32_swap_order (b + 110 + offset);
521
526
aux_package[board_descr[" auxiliary" ][" magnetometer_channels" ][2 ].get <int > ()] =
522
- magnetometer_scale * cast_16bit_to_int32 (b + 112 + offset);
527
+ magnetometer_scale_z *
528
+ (double )cast_15bit_to_int32_swap_order (b + 112 + offset);
523
529
524
530
push_package (aux_package, (int )BrainFlowPresets::AUXILIARY_PRESET);
525
531
}
0 commit comments