Skip to content

Commit

Permalink
Public release of MSCL 13.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rwslord committed Oct 13, 2016
1 parent ab5e506 commit 658529c
Show file tree
Hide file tree
Showing 33 changed files with 642 additions and 372 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ The MINOR version is incremented when a new feature is added (to the public inte
The PATCH version is incremented when a bug is fixed.
======================================================================================================

-------------------------------------------------------------------------
13.1.1 - 2016-10-13
- fix for datalogging download v1 erroneously parsing data when retrying after a communication exception.

-------------------------------------------------------------------------
13.1.0 - 2016-10-12
- attempting to read ASPP version off of Node if available instead of using FW version.
- clearing internal NodeInfo and NodeFeatures when clearEepromCache is called in case eeproms changed.

-------------------------------------------------------------------------
13.0.4 - 2016-10-11
- updated legacy Sync network offset

-------------------------------------------------------------------------
13.0.3 - 2016-10-06
- fix for datalog downloading v2 using incorrect flash sizes for Nodes.

-------------------------------------------------------------------------
13.0.2 - 2016-10-04
- fix for datalog downloading v2 failing to verify checksum correctly.
Expand Down
4 changes: 2 additions & 2 deletions MSCL/source/mscl/LibVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ MIT Licensed. See the included LICENSE.txt for a copy of the full MIT License.
#ifndef SWIG
//update with each release
#define MSCL_MAJOR 13
#define MSCL_MINOR 0
#define MSCL_PATCH 2
#define MSCL_MINOR 1
#define MSCL_PATCH 1
#endif

namespace mscl
Expand Down
2 changes: 1 addition & 1 deletion MSCL/source/mscl/MicroStrain/Inertial/InertialNode_Impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ namespace mscl
// timeout - The timeout (in milliseconds) to set for Inertial commands.
void timeout(uint64 timeout);

//API Function: timeout
//Function: timeout
// Gets the timeout to use when waiting for responses from Inertial commands.
//
//Returns:
Expand Down
43 changes: 36 additions & 7 deletions MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,46 @@ MIT Licensed. See the included LICENSE.txt for a copy of the full MIT License.
namespace mscl
{
//read the required information from the BaseStation and store in the BaseStationInfo
BaseStationInfo::BaseStationInfo(const BaseStation_Impl& base) :
firmwareVersion(base.firmwareVersion()),
model(base.model()),
regionCode(base.regionCode())
BaseStationInfo::BaseStationInfo(const BaseStation_Impl* base) :
m_basestation(base)
{
}

BaseStationInfo::BaseStationInfo(Version fw, WirelessModels::BaseModel model, WirelessTypes::RegionCode region):
firmwareVersion(fw),
model(model),
regionCode(region)
m_firmwareVersion(fw),
m_model(model),
m_regionCode(region)
{
}

Version BaseStationInfo::firmwareVersion() const
{
if(!static_cast<bool>(m_firmwareVersion))
{
m_firmwareVersion = m_basestation->firmwareVersion();
}

return *m_firmwareVersion;
}

WirelessModels::BaseModel BaseStationInfo::model() const
{
if(!static_cast<bool>(m_model))
{
m_model = m_basestation->model();
}

return *m_model;
}

WirelessTypes::RegionCode BaseStationInfo::regionCode() const
{
if(!static_cast<bool>(m_regionCode))
{
m_regionCode = m_basestation->regionCode();
}

return *m_regionCode;
}

}
25 changes: 17 additions & 8 deletions MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ MIT Licensed. See the included LICENSE.txt for a copy of the full MIT License.
#include "WirelessTypes.h"
#include "RadioFeatures.h"

#include <boost/optional.hpp>

namespace mscl
{
class BaseStation_Impl; //forward declarations
Expand All @@ -29,7 +31,7 @@ namespace mscl
//Exceptions:
// - <Error_Communication>: Failed to read the value from the BaseStation.
// - <Error_Connection>: A connection error has occurred with the parent BaseStation.
BaseStationInfo(const BaseStation_Impl& base);
BaseStationInfo(const BaseStation_Impl* base);

//Constructor: BaseStationInfo
// Creates a BaseStationInfo object.
Expand All @@ -43,17 +45,24 @@ namespace mscl
private:
BaseStationInfo(); //disabled default constructor

public:
//Variable: firmwareVersion
const BaseStation_Impl* m_basestation;

private:
//Variable: m_firmwareVersion
// The firmware <Version> of the BaseStation.
Version firmwareVersion;
mutable boost::optional<Version> m_firmwareVersion;

//Variable: model
//Variable: m_model
// The <WirelessModels::BaseModel> of the BaseStation.
WirelessModels::BaseModel model;
mutable boost::optional<WirelessModels::BaseModel> m_model;

//Variable: regionCode
//Variable: m_regionCode
// The <WirelessTypes::RegionCode> of the BaseStation.
WirelessTypes::RegionCode regionCode;
mutable boost::optional<WirelessTypes::RegionCode> m_regionCode;

public:
Version firmwareVersion() const;
WirelessModels::BaseModel model() const;
WirelessTypes::RegionCode regionCode() const;
};
}
114 changes: 26 additions & 88 deletions MSCL/source/mscl/MicroStrain/Wireless/BaseStation_Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace mscl

std::unique_ptr<WirelessProtocol> BaseStation_Impl::determineProtocol()
{
Version fwVersion;
Version asppVersion;

uint8 origRetries = m_eeprom->getNumRetries();

Expand All @@ -108,20 +108,20 @@ namespace mscl
// Determine the firmware version by attempting to use multiple protocols
try
{
//try reading with protocol v1.1
//try reading with protocol v1.1 (has read eeprom v2)
m_protocol = WirelessProtocol::v1_1();

fwVersion = firmwareVersion();
asppVersion = m_eepromHelper->read_asppVersion();
success = true;
}
catch(Error_Communication&)
{
try
{
//try reading with protocol v1.0
//try reading with protocol v1.0 (has read eeprom v1)
m_protocol = WirelessProtocol::v1_0();

fwVersion = firmwareVersion();
asppVersion = m_eepromHelper->read_asppVersion();
success = true;
}
catch(Error_Communication&)
Expand All @@ -130,6 +130,8 @@ namespace mscl
if(retryCount >= origRetries)
{
//we failed to determine the protocol
//need to clear out the protocol
m_protocol.reset();

//rethrow the exception
throw;
Expand All @@ -140,8 +142,8 @@ namespace mscl
}
while(!success && (retryCount++ < origRetries));

//get the protocol to use for the base station's fw version
return WirelessProtocol::chooseBaseStationProtocol(fwVersion);
//get the protocol to use for the base station
return WirelessProtocol::getProtocol(asppVersion);
}

BaseStationEepromHelper& BaseStation_Impl::eeHelper() const
Expand Down Expand Up @@ -170,7 +172,7 @@ namespace mscl
if(m_features == NULL)
{
//create the BaseStationInfo to give to the features
BaseStationInfo info(*this);
BaseStationInfo info(this);

//set the features variable by creating a new BaseStationFeatures pointer
m_features = BaseStationFeatures::create(info);
Expand Down Expand Up @@ -241,6 +243,18 @@ namespace mscl
void BaseStation_Impl::clearEepromCache()
{
m_eeprom->clearCache();

//features may need to be reset if firmware version or model changed
if(m_features != NULL)
{
m_features.reset();
}

//protocol may need to be reset if ASPP of firmware version changed
if(m_protocol != NULL)
{
m_protocol.reset();
}
}

WirelessTypes::Frequency BaseStation_Impl::frequency() const
Expand All @@ -262,98 +276,22 @@ namespace mscl

Version BaseStation_Impl::firmwareVersion() const
{
//Note: this function can never use the BaseStaionFeatures/BaseStationInfo call, as BaseStationInfo relies on this function.

//read the firmware version eeprom
uint16 fwValue1 = readEeprom(BaseStationEepromMap::FIRMWARE_VER).as_uint16();

uint8 major = Utils::msb(fwValue1);

//firmware versions < 4 use the scheme [Major].[Minor]
if(major < 4)
{
uint8 minor = Utils::lsb(fwValue1);

return Version(major, minor);
}
//firmware versions >= 4 use the scheme [Major].[svnRevision]
else
{
uint16 fwValue2 = readEeprom(BaseStationEepromMap::FIRMWARE_VER2).as_uint16();

//make the svn revision from the lsb of the first fw value, and the entire second fw value
uint32 svnRevision = Utils::make_uint32(0, Utils::lsb(fwValue1), Utils::msb(fwValue2), Utils::lsb(fwValue2));

return Version(major, svnRevision);
}
return m_eepromHelper->read_fwVersion();
}

WirelessModels::BaseModel BaseStation_Impl::model() const
{
//Note: this function can never use the BaseStaionFeatures/BaseStationInfo call, as BaseStationInfo relies on this function.

//read the model number from eeprom
uint16 model = readEeprom(BaseStationEepromMap::MODEL_NUMBER).as_uint16();

//if the model stored in eeprom is invalid (uninitialized)
if(model == 0xFFFF || model == 0xAAAA || model == 0)
{
//this basestation uses the legacy model number

//read the model from the legacy model eeprom location
model = readEeprom(BaseStationEepromMap::LEGACY_MODEL_NUMBER).as_uint16();

//convert the legacy model to the new model number and return it
return WirelessModels::baseFromLegacyModel(model);
}
else
{
//read the model option from eeprom
uint16 modelOption = readEeprom(BaseStationEepromMap::MODEL_OPTION).as_uint16();

//build the model and model class together to form the model number
return static_cast<WirelessModels::BaseModel>((model * 10000) + modelOption);
}
return m_eepromHelper->read_model();
}

std::string BaseStation_Impl::serial() const
{
//read the serial number
uint32 serial = readEeprom(BaseStationEepromMap::SERIAL_ID).as_uint32();

//if the serial stored in eeprom is invalid (uninitialized)
if(serial == 0xFFFFFFFF || serial == 0xAAAAAAAA || serial == 0)
{
//this basestation uses the legacy serial number

//read the serial from the legacy serial id eeprom location
serial = readEeprom(BaseStationEepromMap::LEGACY_SERIAL_ID).as_uint16();
}

//get the model number of the basestation
WirelessModels::BaseModel fullModel = model();

//split the model into its 2 pieces
uint16 model = static_cast<uint16>(fullModel / 10000);
uint16 modelClass = fullModel % 10000;

//build the string result
std::stringstream modelStr;
modelStr << std::setfill('0') << std::setw(4) << model;

std::stringstream modelClassStr;
modelClassStr << std::setfill('0') << std::setw(4) << modelClass;

std::stringstream serialStr;
serialStr << std::setfill('0') << std::setw(5) << serial;

return modelStr.str() + "-" + modelClassStr.str() + "-" + serialStr.str();
return m_eepromHelper->read_serial();
}

WirelessTypes::MicroControllerType BaseStation_Impl::microcontroller() const
{
//read the value from eeprom
return static_cast<WirelessTypes::MicroControllerType>(readEeprom(BaseStationEepromMap::MICROCONTROLLER).as_uint16());
return m_eepromHelper->read_microcontroller();
}

void BaseStation_Impl::getData(std::vector<DataSweep>& sweeps, uint32 timeout, uint32 maxSweeps)
Expand Down
Loading

0 comments on commit 658529c

Please sign in to comment.