Skip to content

Commit

Permalink
SITL: split to MicroStrain5
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 authored and tridge committed Aug 29, 2023
1 parent fd3a1d4 commit 461a8dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions libraries/SITL/SIM_MicroStrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

using namespace SITL;

MicroStrain::MicroStrain() :SerialDevice::SerialDevice()
MicroStrain5::MicroStrain5() :SerialDevice::SerialDevice()
{
}

Expand All @@ -48,7 +48,7 @@ static void simulation_timeval(struct timeval *tv)
tv->tv_usec = new_usec % 1000000ULL;
}

void MicroStrain::generate_checksum(MicroStrain_Packet& packet)
void MicroStrain5::generate_checksum(MicroStrain_Packet& packet)
{
uint8_t checksumByte1 = 0;
uint8_t checksumByte2 = 0;
Expand All @@ -67,7 +67,7 @@ void MicroStrain::generate_checksum(MicroStrain_Packet& packet)
packet.checksum[1] = checksumByte2;
}

void MicroStrain::send_packet(MicroStrain_Packet packet)
void MicroStrain5::send_packet(MicroStrain_Packet packet)
{
generate_checksum(packet);

Expand All @@ -77,7 +77,7 @@ void MicroStrain::send_packet(MicroStrain_Packet packet)
}


void MicroStrain::send_imu_packet(void)
void MicroStrain5::send_imu_packet(void)
{
const auto &fdm = _sitl->state;
MicroStrain_Packet packet;
Expand Down Expand Up @@ -136,7 +136,7 @@ void MicroStrain::send_imu_packet(void)
}


void MicroStrain::send_gnss_packet(void)
void MicroStrain5::send_gnss_packet(void)
{
const auto &fdm = _sitl->state;
MicroStrain_Packet packet;
Expand Down Expand Up @@ -205,7 +205,7 @@ void MicroStrain::send_gnss_packet(void)
send_packet(packet);
}

void MicroStrain::send_filter_packet(void)
void MicroStrain5::send_filter_packet(void)
{
const auto &fdm = _sitl->state;
MicroStrain_Packet packet;
Expand Down Expand Up @@ -256,7 +256,7 @@ void MicroStrain::send_filter_packet(void)
/*
send MicroStrain data
*/
void MicroStrain::update(void)
void MicroStrain5::update(void)
{
if (!init_sitl_pointer()) {
return;
Expand All @@ -283,23 +283,23 @@ void MicroStrain::update(void)
}
}

void MicroStrain::put_float(MicroStrain_Packet &packet, float f)
void MicroStrain5::put_float(MicroStrain_Packet &packet, float f)
{
uint32_t fbits = 0;
memcpy(&fbits, &f, sizeof(fbits));
put_be32_ptr(&packet.payload[packet.payload_size], fbits);
packet.payload_size += sizeof(float);
}

void MicroStrain::put_double(MicroStrain_Packet &packet, double d)
void MicroStrain5::put_double(MicroStrain_Packet &packet, double d)
{
uint64_t dbits = 0;
memcpy(&dbits, &d, sizeof(dbits));
put_be64_ptr(&packet.payload[packet.payload_size], dbits);
packet.payload_size += sizeof(double);
}

void MicroStrain::put_int(MicroStrain_Packet &packet, uint16_t t)
void MicroStrain5::put_int(MicroStrain_Packet &packet, uint16_t t)
{
put_be16_ptr(&packet.payload[packet.payload_size], t);
packet.payload_size += sizeof(uint16_t);
Expand Down
4 changes: 2 additions & 2 deletions libraries/SITL/SIM_MicroStrain.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
namespace SITL
{

class MicroStrain : public SerialDevice
class MicroStrain5 : public SerialDevice
{
public:

MicroStrain();
MicroStrain5();

// update state
void update(void);
Expand Down

0 comments on commit 461a8dc

Please sign in to comment.