From 658529c3212a573510739c9c787cca43ef869cc9 Mon Sep 17 00:00:00 2001 From: Richard Stoneback Date: Thu, 13 Oct 2016 11:13:17 -0400 Subject: [PATCH] Public release of MSCL 13.1.1 --- CHANGELOG.txt | 17 ++ MSCL/source/mscl/LibVersion.h | 4 +- .../MicroStrain/Inertial/InertialNode_Impl.h | 2 +- .../MicroStrain/Wireless/BaseStationInfo.cpp | 43 ++- .../MicroStrain/Wireless/BaseStationInfo.h | 25 +- .../MicroStrain/Wireless/BaseStation_Impl.cpp | 114 ++------ .../Wireless/Commands/WirelessProtocol.cpp | 39 ++- .../Wireless/Commands/WirelessProtocol.h | 19 +- .../Configuration/BaseStationEepromHelper.cpp | 124 +++++++++ .../Configuration/BaseStationEepromHelper.h | 42 +++ .../Configuration/BaseStationEepromMap.cpp | 1 + .../Configuration/BaseStationEepromMap.h | 250 +++++++++--------- .../Configuration/NodeEepromHelper.cpp | 31 +++ .../Wireless/Configuration/NodeEepromHelper.h | 12 + .../Wireless/Configuration/NodeEepromMap.cpp | 1 + .../Wireless/Configuration/NodeEepromMap.h | 2 + .../Wireless/DatalogDownloader.cpp | 164 ++++++------ .../Wireless/Features/BaseStationFeatures.cpp | 14 +- .../Wireless/Features/FlashInfo.cpp | 4 +- .../Wireless/Features/NodeFeatures.cpp | 2 +- .../Wireless/Features/NodeFeatures.h | 2 +- .../Wireless/Features/NodeInfo.cpp | 4 - .../mscl/MicroStrain/Wireless/NodeMemory.h | 7 + .../mscl/MicroStrain/Wireless/NodeMemory_v1.h | 14 +- .../MicroStrain/Wireless/NodeMemory_v2.cpp | 7 + .../mscl/MicroStrain/Wireless/NodeMemory_v2.h | 7 + .../Wireless/SyncSamplingNetwork.cpp | 2 +- .../Wireless/WirelessNode_Impl.cpp | 29 +- MSCL_Managed/Properties/AssemblyInfo.cs | 4 +- MSCL_Unit_Tests/Test_BaseStation.cpp | 14 - MSCL_Unit_Tests/Test_BaseStationConfig.cpp | 1 + MSCL_Unit_Tests/Test_DatalogDownloader.cpp | 3 + MSCL_Unit_Tests/Test_WirelessNode.cpp | 10 +- 33 files changed, 642 insertions(+), 372 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1b9744a80..5e7380503 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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. diff --git a/MSCL/source/mscl/LibVersion.h b/MSCL/source/mscl/LibVersion.h index 36ded2fc5..c23dd11d6 100644 --- a/MSCL/source/mscl/LibVersion.h +++ b/MSCL/source/mscl/LibVersion.h @@ -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 diff --git a/MSCL/source/mscl/MicroStrain/Inertial/InertialNode_Impl.h b/MSCL/source/mscl/MicroStrain/Inertial/InertialNode_Impl.h index 018049eba..167f75810 100644 --- a/MSCL/source/mscl/MicroStrain/Inertial/InertialNode_Impl.h +++ b/MSCL/source/mscl/MicroStrain/Inertial/InertialNode_Impl.h @@ -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: diff --git a/MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.cpp b/MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.cpp index eb79f72de..c9c028d6b 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.cpp @@ -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(m_firmwareVersion)) + { + m_firmwareVersion = m_basestation->firmwareVersion(); + } + + return *m_firmwareVersion; + } + + WirelessModels::BaseModel BaseStationInfo::model() const + { + if(!static_cast(m_model)) + { + m_model = m_basestation->model(); + } + + return *m_model; + } + + WirelessTypes::RegionCode BaseStationInfo::regionCode() const + { + if(!static_cast(m_regionCode)) + { + m_regionCode = m_basestation->regionCode(); + } + + return *m_regionCode; + } + } \ No newline at end of file diff --git a/MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.h b/MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.h index 79b20d989..0b6a18bb3 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/BaseStationInfo.h @@ -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 + namespace mscl { class BaseStation_Impl; //forward declarations @@ -29,7 +31,7 @@ namespace mscl //Exceptions: // - : Failed to read the value from the BaseStation. // - : 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. @@ -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 of the BaseStation. - Version firmwareVersion; + mutable boost::optional m_firmwareVersion; - //Variable: model + //Variable: m_model // The of the BaseStation. - WirelessModels::BaseModel model; + mutable boost::optional m_model; - //Variable: regionCode + //Variable: m_regionCode // The of the BaseStation. - WirelessTypes::RegionCode regionCode; + mutable boost::optional m_regionCode; + + public: + Version firmwareVersion() const; + WirelessModels::BaseModel model() const; + WirelessTypes::RegionCode regionCode() const; }; } \ No newline at end of file diff --git a/MSCL/source/mscl/MicroStrain/Wireless/BaseStation_Impl.cpp b/MSCL/source/mscl/MicroStrain/Wireless/BaseStation_Impl.cpp index 4d3151e7b..d1d49dd54 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/BaseStation_Impl.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/BaseStation_Impl.cpp @@ -90,7 +90,7 @@ namespace mscl std::unique_ptr BaseStation_Impl::determineProtocol() { - Version fwVersion; + Version asppVersion; uint8 origRetries = m_eeprom->getNumRetries(); @@ -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&) @@ -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; @@ -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 @@ -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); @@ -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 @@ -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((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(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(readEeprom(BaseStationEepromMap::MICROCONTROLLER).as_uint16()); + return m_eepromHelper->read_microcontroller(); } void BaseStation_Impl::getData(std::vector& sweeps, uint32 timeout, uint32 maxSweeps) diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Commands/WirelessProtocol.cpp b/MSCL/source/mscl/MicroStrain/Wireless/Commands/WirelessProtocol.cpp index a48a68ade..86dd29302 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Commands/WirelessProtocol.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/Commands/WirelessProtocol.cpp @@ -15,46 +15,63 @@ namespace mscl { } - std::unique_ptr WirelessProtocol::chooseBaseStationProtocol(const Version& fwVersion) + Version WirelessProtocol::asppVersionFromBaseFw(const Version& fwVersion) { if(fwVersion >= NodeFeatures::MIN_BASE_FW_PROTOCOL_1_3) { - return v1_3(); + return Version(1, 3); } else if(fwVersion >= NodeFeatures::MIN_BASE_FW_PROTOCOL_1_1) { - return v1_1(); + return Version(1, 1); } else { - return v1_0(); + return Version(1, 0); } } - std::unique_ptr WirelessProtocol::chooseNodeProtocol(const Version& fwVersion) + Version WirelessProtocol::asppVersionFromNodeFw(const Version& fwVersion) { if(fwVersion >= NodeFeatures::MIN_NODE_FW_PROTOCOL_1_5) { - return v1_5(); + return Version(1, 5); } - else if(fwVersion >= NodeFeatures::MIN_NODE_FW_PORTOCOL_1_4) + else if(fwVersion >= NodeFeatures::MIN_NODE_FW_PROTOCOL_1_4) { - return v1_4(); + return Version(1, 4); } else if(fwVersion >= NodeFeatures::MIN_NODE_FW_PROTOCOL_1_2) { - return v1_2(); + return Version(1, 2); } else if(fwVersion >= NodeFeatures::MIN_NODE_FW_PROTOCOL_1_1) { - return v1_1(); + return Version(1, 1); } else { - return v1_0(); + return Version(1, 0); } } + std::unique_ptr WirelessProtocol::getProtocol(const Version& asppVersion) + { + static const Version ASPP_1_1 = Version(1, 1); + static const Version ASPP_1_2 = Version(1, 2); + static const Version ASPP_1_3 = Version(1, 3); + static const Version ASPP_1_4 = Version(1, 4); + static const Version ASPP_1_5 = Version(1, 5); + + if(asppVersion >= ASPP_1_5) { return v1_5(); } + if(asppVersion >= ASPP_1_4) { return v1_4(); } + if(asppVersion >= ASPP_1_3) { return v1_3(); } + if(asppVersion >= ASPP_1_2) { return v1_2(); } + if(asppVersion >= ASPP_1_1) { return v1_1(); } + + return v1_0(); + } + std::unique_ptr WirelessProtocol::v1_0() { std::unique_ptr result(new WirelessProtocol()); diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Commands/WirelessProtocol.h b/MSCL/source/mscl/MicroStrain/Wireless/Commands/WirelessProtocol.h index 6dc9c7a1e..58581a526 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Commands/WirelessProtocol.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/Commands/WirelessProtocol.h @@ -95,19 +95,26 @@ namespace mscl // The address of our generic Base Station. static const uint16 BASE_STATION_ADDRESS = 0x1234; - //Function: chooseBaseStationProtocol - // Returns the correct protocol version based on the Base Station's firmware vesrion. + //Function: asppVersionFromBaseFw + // Gets the ASPP version from the Base Station firmware version. // //Parameters: // fwVersion - The firmware version of the Base Station. - static std::unique_ptr chooseBaseStationProtocol(const Version& fwVersion); + static Version asppVersionFromBaseFw(const Version& fwVersion); - //Function: chooseBaseStationProtocol - // Returns the correct protocol version based on the Wireless Node's firmware vesrion. + //Function: asppVersionFromNodeFw + // Gets the ASPP version from the Node firmware version. // //Parameters: // fwVersion - The firmware version of the Node. - static std::unique_ptr chooseNodeProtocol(const Version& fwVersion); + static Version asppVersionFromNodeFw(const Version& fwVersion); + + //Function: getProtocol + // Returns the ASPP protocol based on the ASPP version. + // + //Parameters: + // asppVersion - The of the ASPP protocol that is supported. + static std::unique_ptr getProtocol(const Version& asppVersion); //Function: v1_0 // Static function to create a WirelessProtocol with version 1.0. diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromHelper.cpp b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromHelper.cpp index cbbffac05..5e45cbf20 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromHelper.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromHelper.cpp @@ -9,6 +9,7 @@ MIT Licensed. See the included LICENSE.txt for a copy of the full MIT License. #include "BaseStationEepromMap.h" #include "mscl/MicroStrain/Wireless/BaseStation_Impl.h" #include "mscl/MicroStrain/Wireless/Features/BaseStationFeatures.h" +#include "mscl/MicroStrain/Wireless/Commands/WirelessProtocol.h" namespace mscl { @@ -36,6 +37,129 @@ namespace mscl m_baseStation->writeEeprom(location, val); } + Version BaseStationEepromHelper::read_asppVersion() const + { + uint16 asppValue = 0; + + try + { + //read the ASPP vesrion eeprom + asppValue = read(BaseStationEepromMap::ASPP_VER).as_uint16(); + } + catch(Error_NotSupported&) + { + //if the eeprom isn't supported, just leave it as 0 + //which will then fall back to the firmware version to + //determine the ASPP version number + } + + //if the aspp version is uninitialized + if(asppValue == 0xFFFF || asppValue == 0xAAAA || asppValue == 0) + { + Version fwVersion = read_fwVersion(); + + //convert the firmware version of the ASPP version + return WirelessProtocol::asppVersionFromBaseFw(fwVersion); + } + else + { + //ASPP version is good in eeprom, just return that version number + return Version(Utils::msb(asppValue), Utils::lsb(asppValue)); + } + } + + Version BaseStationEepromHelper::read_fwVersion() const + { + //read the firmware version eeprom + uint16 fwValue1 = read(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 = read(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); + } + } + + WirelessModels::BaseModel BaseStationEepromHelper::read_model() const + { + //read the model number from eeprom + uint16 model = read(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 = read(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 = read(BaseStationEepromMap::MODEL_OPTION).as_uint16(); + + //build the model and model class together to form the model number + return static_cast((model * 10000) + modelOption); + } + } + + std::string BaseStationEepromHelper::read_serial() const + { + //read the serial number + uint32 serial = read(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 = read(BaseStationEepromMap::LEGACY_SERIAL_ID).as_uint16(); + } + + //get the model number of the basestation + WirelessModels::BaseModel fullModel = read_model(); + + //split the model into its 2 pieces + uint16 model = static_cast(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(); + } + + WirelessTypes::MicroControllerType BaseStationEepromHelper::read_microcontroller() const + { + //read the value from eeprom + return static_cast(read(BaseStationEepromMap::MICROCONTROLLER).as_uint16()); + } + WirelessTypes::TransmitPower BaseStationEepromHelper::read_transmitPower() const { int16 val = read(BaseStationEepromMap::TX_POWER_LEVEL).as_int16(); diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromHelper.h b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromHelper.h index 34e727a29..093692f17 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromHelper.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromHelper.h @@ -8,6 +8,8 @@ MIT Licensed. See the included LICENSE.txt for a copy of the full MIT License. #include #include "EepromLocation.h" #include "mscl/Value.h" +#include "mscl/Version.h" +#include "mscl/MicroStrain/Wireless/WirelessModels.h" #include "mscl/MicroStrain/Wireless/WirelessTypes.h" #include "mscl/MicroStrain/Wireless/BaseStationButton.h" #include "mscl/MicroStrain/Wireless/BaseStationAnalogPair.h" @@ -51,6 +53,46 @@ namespace mscl void write(const EepromLocation& location, const Value& val); public: + //Function: read_asppVersion + // Gets the ASPP of the BaseStation. + // + //Exceptions: + // - : Failed to read the value from the Node. + // - : A connection error has occurred with the parent BaseStation. + Version read_asppVersion() const; + + //Function: read_fwVersion + // Reads the firmware of the BaseStation. + // + //Exceptions: + // - : Failed to read from the BaseStation. + // - : A connection error has occurred with the BaseStation. + Version read_fwVersion() const; + + //Function: read_model + // Reads the of the BaseStation. + // + //Exceptions: + // - : Failed to read from the BaseStation. + // - : A connection error has occurred with the BaseStation. + WirelessModels::BaseModel read_model() const; + + //Function: read_serial + // Reads the serial of the BaseStation. + // + //Exceptions: + // - : Failed to read from the BaseStation. + // - : A connection error has occurred with the BaseStation. + std::string read_serial() const; + + //Function: read_microcontroller + // Reads the of the BaseStation. + // + //Exceptions: + // - : Failed to read from the BaseStation. + // - : A connection error has occurred with the BaseStation. + WirelessTypes::MicroControllerType read_microcontroller() const; + //Function: read_transmitPower // Reads the that is currently set on the BaseStation. // diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromMap.cpp b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromMap.cpp index 0e762a620..f4f56f903 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromMap.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromMap.cpp @@ -25,6 +25,7 @@ namespace mscl const EepromLocation BaseStationEepromMap::RADIO_ID (118, valueType_uint16); const EepromLocation BaseStationEepromMap::MICROCONTROLLER (120, valueType_uint16); const EepromLocation BaseStationEepromMap::FW_ARCH_VER (122, valueType_uint16); + const EepromLocation BaseStationEepromMap::ASPP_VER (124, valueType_uint16); const EepromLocation BaseStationEepromMap::ANALOG_1_NODE_ADDRESS (128, valueType_uint16); const EepromLocation BaseStationEepromMap::ANALOG_1_NODE_CHANNEL (130, valueType_uint16); const EepromLocation BaseStationEepromMap::ANALOG_1_FLOAT_MAX (132, valueType_float); diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromMap.h b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromMap.h index 9b16c62ce..1e9f54b77 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromMap.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/BaseStationEepromMap.h @@ -53,137 +53,139 @@ namespace mscl //======================================================================================================================= //Constants: Eeprom Locations // - // SERIAL_ID -The serial ID for the base station. Combine with the model number for the full serial number - // BEACON_CONFIG -Configuration of the beacon - // MODEL_NUMBER -The model number of the base station - // MODEL_OPTION -The model option of the base station - // FREQUENCY -The radio frequency channel - // TX_POWER_LEVEL -The transmit output power of the radio - // BEACON_SOURCE -The source of the beacon - // FIRMWARE_VER -The firmware version of the base station (part 1) - // FIRMWARE_VER2 -The firmware version of the base station (part 2) + // SERIAL_ID -The serial ID for the base station. Combine with the model number for the full serial number + // BEACON_CONFIG -Configuration of the beacon + // MODEL_NUMBER -The model number of the base station + // MODEL_OPTION -The model option of the base station + // FREQUENCY -The radio frequency channel + // TX_POWER_LEVEL -The transmit output power of the radio + // BEACON_SOURCE -The source of the beacon + // FIRMWARE_VER -The firmware version of the base station (part 1) + // FIRMWARE_VER2 -The firmware version of the base station (part 2) // LEGACY_MODEL_NUMBER -The (legacy) model number of the base station - // LEGACY_SERIAL_ID -The (legacy) serial ID for the base station. Combine with the model number for the full serial number - // RADIO_ID -The id of the radio on the base station + // LEGACY_SERIAL_ID -The (legacy) serial ID for the base station. Combine with the model number for the full serial number + // RADIO_ID -The id of the radio on the base station // MICROCONTROLLER -The id of the microcontroller // FW_ARCH_VER -The firmware architecture version - // ANALOG_1_NODE_ADDRESS -The Node Address to Pair to Analog Port 1 - // ANALOG_1_NODE_CHANNEL -The Node Channel to Pair to Analog Port 1 - // ANALOG_1_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 1 - // ANALOG_1_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 1 - // ANALOG_2_NODE_ADDRESS -The Node Address to Pair to Analog Port 2 - // ANALOG_2_NODE_CHANNEL -The Node Channel to Pair to Analog Port 2 - // ANALOG_2_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 2 - // ANALOG_2_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 2 - // ANALOG_3_NODE_ADDRESS -The Node Address to Pair to Analog Port 3 - // ANALOG_3_NODE_CHANNEL -The Node Channel to Pair to Analog Port 3 - // ANALOG_3_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 3 - // ANALOG_3_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 3 - // ANALOG_4_NODE_ADDRESS -The Node Address to Pair to Analog Port 4 - // ANALOG_4_NODE_CHANNEL -The Node Channel to Pair to Analog Port 4 - // ANALOG_4_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 4 - // ANALOG_4_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 4 - // ANALOG_5_NODE_ADDRESS -The Node Address to Pair to Analog Port 5 - // ANALOG_5_NODE_CHANNEL -The Node Channel to Pair to Analog Port 5 - // ANALOG_5_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 5 - // ANALOG_5_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 5 - // ANALOG_6_NODE_ADDRESS -The Node Address to Pair to Analog Port 6 - // ANALOG_6_NODE_CHANNEL -The Node Channel to Pair to Analog Port 6 - // ANALOG_6_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 6 - // ANALOG_6_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 6 - // ANALOG_7_NODE_ADDRESS -The Node Address to Pair to Analog Port 7 - // ANALOG_7_NODE_CHANNEL -The Node Channel to Pair to Analog Port 7 - // ANALOG_7_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 7 - // ANALOG_7_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 7 - // ANALOG_8_NODE_ADDRESS -The Node Address to Pair to Analog Port 8 - // ANALOG_8_NODE_CHANNEL -The Node Channel to Pair to Analog Port 8 - // ANALOG_8_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 8 - // ANALOG_8_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 8 - // ANALOG_PAIRING_ENABLE -Enable/Disable analog pairing on an analog base station + // ASPP_VER -The ASPP version of the device + // ANALOG_1_NODE_ADDRESS -The Node Address to Pair to Analog Port 1 + // ANALOG_1_NODE_CHANNEL -The Node Channel to Pair to Analog Port 1 + // ANALOG_1_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 1 + // ANALOG_1_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 1 + // ANALOG_2_NODE_ADDRESS -The Node Address to Pair to Analog Port 2 + // ANALOG_2_NODE_CHANNEL -The Node Channel to Pair to Analog Port 2 + // ANALOG_2_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 2 + // ANALOG_2_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 2 + // ANALOG_3_NODE_ADDRESS -The Node Address to Pair to Analog Port 3 + // ANALOG_3_NODE_CHANNEL -The Node Channel to Pair to Analog Port 3 + // ANALOG_3_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 3 + // ANALOG_3_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 3 + // ANALOG_4_NODE_ADDRESS -The Node Address to Pair to Analog Port 4 + // ANALOG_4_NODE_CHANNEL -The Node Channel to Pair to Analog Port 4 + // ANALOG_4_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 4 + // ANALOG_4_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 4 + // ANALOG_5_NODE_ADDRESS -The Node Address to Pair to Analog Port 5 + // ANALOG_5_NODE_CHANNEL -The Node Channel to Pair to Analog Port 5 + // ANALOG_5_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 5 + // ANALOG_5_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 5 + // ANALOG_6_NODE_ADDRESS -The Node Address to Pair to Analog Port 6 + // ANALOG_6_NODE_CHANNEL -The Node Channel to Pair to Analog Port 6 + // ANALOG_6_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 6 + // ANALOG_6_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 6 + // ANALOG_7_NODE_ADDRESS -The Node Address to Pair to Analog Port 7 + // ANALOG_7_NODE_CHANNEL -The Node Channel to Pair to Analog Port 7 + // ANALOG_7_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 7 + // ANALOG_7_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 7 + // ANALOG_8_NODE_ADDRESS -The Node Address to Pair to Analog Port 8 + // ANALOG_8_NODE_CHANNEL -The Node Channel to Pair to Analog Port 8 + // ANALOG_8_FLOAT_MAX -The Maximum Float value (3V output) for Analog Port 8 + // ANALOG_8_FLOAT_MIN -The Minimum Float value (0V output) for Analog Port 8 + // ANALOG_PAIRING_ENABLE -Enable/Disable analog pairing on an analog base station // ANALOG_TIMEOUT_TIME -The time (seconds) for the analog timeout on an analog base station - // ANALOG_TIMEOUT_VOLTAGE -The voltage to time out for on an analog base station - // BUTTON1_LONG_FUNC -The function for a long press of Button 1 on a base station with buttons - // BUTTON1_LONG_NODE -The Wireless Node associated with a long press of Button 1 on a base station with buttons - // BUTTON1_SHORT_FUNC -The function for a short press of Button 1 on a base station with buttons - // BUTTON1_SHORT_NODE -The Wireless Node associated with a short press of Button 1 on a base station with buttons - // BUTTON2_LONG_FUNC -The function for a long press of Button 2 on a base station with buttons - // BUTTON2_LONG_NODE -The Wireless Node associated with a long press of Button 2 on a base station with buttons - // BUTTON2_SHORT_FUNC -The function for a short press of Button 2 on a base station with buttons - // BUTTON2_SHORT_NODE -The Wireless Node associated with a short press of Button 2 on a base station with buttons - // LED_ACTION -Controls the action of the LED on the base station - // BAUD_RATE -The baud rate of the serial connection with the base station + // ANALOG_TIMEOUT_VOLTAGE -The voltage to time out for on an analog base station + // BUTTON1_LONG_FUNC -The function for a long press of Button 1 on a base station with buttons + // BUTTON1_LONG_NODE -The Wireless Node associated with a long press of Button 1 on a base station with buttons + // BUTTON1_SHORT_FUNC -The function for a short press of Button 1 on a base station with buttons + // BUTTON1_SHORT_NODE -The Wireless Node associated with a short press of Button 1 on a base station with buttons + // BUTTON2_LONG_FUNC -The function for a long press of Button 2 on a base station with buttons + // BUTTON2_LONG_NODE -The Wireless Node associated with a long press of Button 2 on a base station with buttons + // BUTTON2_SHORT_FUNC -The function for a short press of Button 2 on a base station with buttons + // BUTTON2_SHORT_NODE -The Wireless Node associated with a short press of Button 2 on a base station with buttons + // LED_ACTION -Controls the action of the LED on the base station + // BAUD_RATE -The baud rate of the serial connection with the base station // CYCLE_POWER -Used to soft reset the base station // REGION_CODE -The region code for the device - // ANALOG_EXCEED_MAX -The maximum value for the Analog Exceedance setting - // ANALOG_EXCEED_MIN -The minimum value for the Analog Exceedance setting - // ANALOG_EXCEED_ENABLE -Enable/Disable analog exceedance - // MIN_SOFT_VER_MAJOR -The minimum software version for support of this device (major) - // MIN_SOFT_VER_MINOR -The minimum software version for support of this device (minor) + // ANALOG_EXCEED_MAX -The maximum value for the Analog Exceedance setting + // ANALOG_EXCEED_MIN -The minimum value for the Analog Exceedance setting + // ANALOG_EXCEED_ENABLE -Enable/Disable analog exceedance + // MIN_SOFT_VER_MAJOR -The minimum software version for support of this device (major) + // MIN_SOFT_VER_MINOR -The minimum software version for support of this device (minor) //======================================================================================================================= - static const EepromLocation SERIAL_ID; //-The serial ID for the base station. Combine with the model number for the full serial number - static const EepromLocation BEACON_CONFIG; //-Configuration of the beacon - static const EepromLocation MODEL_NUMBER; //-The model number of the base station - static const EepromLocation MODEL_OPTION; //-The model option of the base station - static const EepromLocation FREQUENCY; //-The radio frequency channel - static const EepromLocation TX_POWER_LEVEL; //-The transmit output power of the radio - static const EepromLocation BEACON_SOURCE; //-The source of the beacon - static const EepromLocation FIRMWARE_VER; //-The firmware version of the base station (part 1) - static const EepromLocation FIRMWARE_VER2; //-The firmware version of the base station (part 2) - static const EepromLocation LEGACY_MODEL_NUMBER; //-The (legacy) model number of the base station - static const EepromLocation LEGACY_SERIAL_ID; //-The (legacy) serial ID for the base station. Combine with the model number for the full serial number - static const EepromLocation RADIO_ID; //-The id of the radio on the base station - static const EepromLocation MICROCONTROLLER; //-The id of the microcontroller - static const EepromLocation FW_ARCH_VER; //-The firmware architecture version - static const EepromLocation ANALOG_1_NODE_ADDRESS; //-The Node Address to Pair to Analog Port 1 - static const EepromLocation ANALOG_1_NODE_CHANNEL; //-The Node Channel to Pair to Analog Port 1 - static const EepromLocation ANALOG_1_FLOAT_MAX; //-The Maximum Float value (3V output) for Analog Port 1 - static const EepromLocation ANALOG_1_FLOAT_MIN; //-The Minimum Float value (3V output) for Analog Port 1 - static const EepromLocation ANALOG_2_NODE_ADDRESS; //-The Node Address to Pair to Analog Port 2 - static const EepromLocation ANALOG_2_NODE_CHANNEL; //-The Node Channel to Pair to Analog Port 2 - static const EepromLocation ANALOG_2_FLOAT_MAX; //-The Maximum Float value (3V output) for Analog Port 2 - static const EepromLocation ANALOG_2_FLOAT_MIN; //-The Minimum Float value (3V output) for Analog Port 2 - static const EepromLocation ANALOG_3_NODE_ADDRESS; //-The Node Address to Pair to Analog Port 3 - static const EepromLocation ANALOG_3_NODE_CHANNEL; //-The Node Channel to Pair to Analog Port 3 - static const EepromLocation ANALOG_3_FLOAT_MAX; //-The Maximum Float value (3V output) for Analog Port 3 - static const EepromLocation ANALOG_3_FLOAT_MIN; //-The Minimum Float value (3V output) for Analog Port 3 - static const EepromLocation ANALOG_4_NODE_ADDRESS; //-The Node Address to Pair to Analog Port 4 - static const EepromLocation ANALOG_4_NODE_CHANNEL; //-The Node Channel to Pair to Analog Port 4 - static const EepromLocation ANALOG_4_FLOAT_MAX; //-The Maximum Float value (3V output) for Analog Port 4 - static const EepromLocation ANALOG_4_FLOAT_MIN; //-The Minimum Float value (3V output) for Analog Port 4 - static const EepromLocation ANALOG_5_NODE_ADDRESS; //-The Node Address to Pair to Analog Port 5 - static const EepromLocation ANALOG_5_NODE_CHANNEL; //-The Node Channel to Pair to Analog Port 5 - static const EepromLocation ANALOG_5_FLOAT_MAX; //-The Maximum Float value (3V output) for Analog Port 5 - static const EepromLocation ANALOG_5_FLOAT_MIN; //-The Minimum Float value (3V output) for Analog Port 5 - static const EepromLocation ANALOG_6_NODE_ADDRESS; //-The Node Address to Pair to Analog Port 6 - static const EepromLocation ANALOG_6_NODE_CHANNEL; //-The Node Channel to Pair to Analog Port 6 - static const EepromLocation ANALOG_6_FLOAT_MAX; //-The Maximum Float value (3V output) for Analog Port 6 - static const EepromLocation ANALOG_6_FLOAT_MIN; //-The Minimum Float value (3V output) for Analog Port 6 - static const EepromLocation ANALOG_7_NODE_ADDRESS; //-The Node Address to Pair to Analog Port 7 - static const EepromLocation ANALOG_7_NODE_CHANNEL; //-The Node Channel to Pair to Analog Port 7 - static const EepromLocation ANALOG_7_FLOAT_MAX; //-The Maximum Float value (3V output) for Analog Port 7 - static const EepromLocation ANALOG_7_FLOAT_MIN; //-The Minimum Float value (3V output) for Analog Port 7 - static const EepromLocation ANALOG_8_NODE_ADDRESS; //-The Node Address to Pair to Analog Port 8 - static const EepromLocation ANALOG_8_NODE_CHANNEL; //-The Node Channel to Pair to Analog Port 8 - static const EepromLocation ANALOG_8_FLOAT_MAX; //-The Maximum Float value (3V output) for Analog Port 8 - static const EepromLocation ANALOG_8_FLOAT_MIN; //-The Minimum Float value (3V output) for Analog Port 8 - static const EepromLocation ANALOG_PAIRING_ENABLE; //-Enable/Disable analog pairing on an analog base station - static const EepromLocation ANALOG_TIMEOUT_TIME; //-The time (seconds) for the analog timeout on an analog base station - static const EepromLocation ANALOG_TIMEOUT_VOLTAGE; //-The voltage to time out for on an analog base station - static const EepromLocation BUTTON1_LONG_FUNC; //-The function for a long press of Button 1 on a base station with buttons - static const EepromLocation BUTTON1_LONG_NODE; //-The Wireless Node associated with a long press of Button 1 on a base station with buttons - static const EepromLocation BUTTON1_SHORT_FUNC; //-The function for a short press of Button 1 on a base station with buttons - static const EepromLocation BUTTON1_SHORT_NODE; //-The Wireless Node associated with a short press of Button 1 on a base station with buttons - static const EepromLocation BUTTON2_LONG_FUNC; //-The function for a long press of Button 2 on a base station with buttons - static const EepromLocation BUTTON2_LONG_NODE; //-The Wireless Node associated with a long press of Button 2 on a base station with buttons - static const EepromLocation BUTTON2_SHORT_FUNC; //-The function for a short press of Button 2 on a base station with buttons - static const EepromLocation BUTTON2_SHORT_NODE; //-The Wireless Node associated with a short press of Button 2 on a base station with buttons - static const EepromLocation LED_ACTION; //-Controls the action of the LED on the base station - static const EepromLocation BAUD_RATE; //-The baud rate of the serial connection with the base station - static const EepromLocation CYCLE_POWER; //-Used to soft reset the base station - static const EepromLocation REGION_CODE; //-The region code for the device. - static const EepromLocation ANALOG_EXCEED_MAX; //-The maximum value for the Analog Exceedance setting - static const EepromLocation ANALOG_EXCEED_MIN; //-The minimum value for the Analog Exceedance setting - static const EepromLocation ANALOG_EXCEED_ENABLE; //-Enable/Disable analog exceedance + static const EepromLocation SERIAL_ID; // The serial ID for the base station. Combine with the model number for the full serial number + static const EepromLocation BEACON_CONFIG; // Configuration of the beacon + static const EepromLocation MODEL_NUMBER; // The model number of the base station + static const EepromLocation MODEL_OPTION; // The model option of the base station + static const EepromLocation FREQUENCY; // The radio frequency channel + static const EepromLocation TX_POWER_LEVEL; // The transmit output power of the radio + static const EepromLocation BEACON_SOURCE; // The source of the beacon + static const EepromLocation FIRMWARE_VER; // The firmware version of the base station (part 1) + static const EepromLocation FIRMWARE_VER2; // The firmware version of the base station (part 2) + static const EepromLocation LEGACY_MODEL_NUMBER; // The (legacy) model number of the base station + static const EepromLocation LEGACY_SERIAL_ID; // The (legacy) serial ID for the base station. Combine with the model number for the full serial number + static const EepromLocation RADIO_ID; // The id of the radio on the base station + static const EepromLocation MICROCONTROLLER; // The id of the microcontroller + static const EepromLocation FW_ARCH_VER; // The firmware architecture version + static const EepromLocation ASPP_VER; // The ASPP version of the device + static const EepromLocation ANALOG_1_NODE_ADDRESS; // The Node Address to Pair to Analog Port 1 + static const EepromLocation ANALOG_1_NODE_CHANNEL; // The Node Channel to Pair to Analog Port 1 + static const EepromLocation ANALOG_1_FLOAT_MAX; // The Maximum Float value (3V output) for Analog Port 1 + static const EepromLocation ANALOG_1_FLOAT_MIN; // The Minimum Float value (3V output) for Analog Port 1 + static const EepromLocation ANALOG_2_NODE_ADDRESS; // The Node Address to Pair to Analog Port 2 + static const EepromLocation ANALOG_2_NODE_CHANNEL; // The Node Channel to Pair to Analog Port 2 + static const EepromLocation ANALOG_2_FLOAT_MAX; // The Maximum Float value (3V output) for Analog Port 2 + static const EepromLocation ANALOG_2_FLOAT_MIN; // The Minimum Float value (3V output) for Analog Port 2 + static const EepromLocation ANALOG_3_NODE_ADDRESS; // The Node Address to Pair to Analog Port 3 + static const EepromLocation ANALOG_3_NODE_CHANNEL; // The Node Channel to Pair to Analog Port 3 + static const EepromLocation ANALOG_3_FLOAT_MAX; // The Maximum Float value (3V output) for Analog Port 3 + static const EepromLocation ANALOG_3_FLOAT_MIN; // The Minimum Float value (3V output) for Analog Port 3 + static const EepromLocation ANALOG_4_NODE_ADDRESS; // The Node Address to Pair to Analog Port 4 + static const EepromLocation ANALOG_4_NODE_CHANNEL; // The Node Channel to Pair to Analog Port 4 + static const EepromLocation ANALOG_4_FLOAT_MAX; // The Maximum Float value (3V output) for Analog Port 4 + static const EepromLocation ANALOG_4_FLOAT_MIN; // The Minimum Float value (3V output) for Analog Port 4 + static const EepromLocation ANALOG_5_NODE_ADDRESS; // The Node Address to Pair to Analog Port 5 + static const EepromLocation ANALOG_5_NODE_CHANNEL; // The Node Channel to Pair to Analog Port 5 + static const EepromLocation ANALOG_5_FLOAT_MAX; // The Maximum Float value (3V output) for Analog Port 5 + static const EepromLocation ANALOG_5_FLOAT_MIN; // The Minimum Float value (3V output) for Analog Port 5 + static const EepromLocation ANALOG_6_NODE_ADDRESS; // The Node Address to Pair to Analog Port 6 + static const EepromLocation ANALOG_6_NODE_CHANNEL; // The Node Channel to Pair to Analog Port 6 + static const EepromLocation ANALOG_6_FLOAT_MAX; // The Maximum Float value (3V output) for Analog Port 6 + static const EepromLocation ANALOG_6_FLOAT_MIN; // The Minimum Float value (3V output) for Analog Port 6 + static const EepromLocation ANALOG_7_NODE_ADDRESS; // The Node Address to Pair to Analog Port 7 + static const EepromLocation ANALOG_7_NODE_CHANNEL; // The Node Channel to Pair to Analog Port 7 + static const EepromLocation ANALOG_7_FLOAT_MAX; // The Maximum Float value (3V output) for Analog Port 7 + static const EepromLocation ANALOG_7_FLOAT_MIN; // The Minimum Float value (3V output) for Analog Port 7 + static const EepromLocation ANALOG_8_NODE_ADDRESS; // The Node Address to Pair to Analog Port 8 + static const EepromLocation ANALOG_8_NODE_CHANNEL; // The Node Channel to Pair to Analog Port 8 + static const EepromLocation ANALOG_8_FLOAT_MAX; // The Maximum Float value (3V output) for Analog Port 8 + static const EepromLocation ANALOG_8_FLOAT_MIN; // The Minimum Float value (3V output) for Analog Port 8 + static const EepromLocation ANALOG_PAIRING_ENABLE; // Enable/Disable analog pairing on an analog base station + static const EepromLocation ANALOG_TIMEOUT_TIME; // The time (seconds) for the analog timeout on an analog base station + static const EepromLocation ANALOG_TIMEOUT_VOLTAGE; // The voltage to time out for on an analog base station + static const EepromLocation BUTTON1_LONG_FUNC; // The function for a long press of Button 1 on a base station with buttons + static const EepromLocation BUTTON1_LONG_NODE; // The Wireless Node associated with a long press of Button 1 on a base station with buttons + static const EepromLocation BUTTON1_SHORT_FUNC; // The function for a short press of Button 1 on a base station with buttons + static const EepromLocation BUTTON1_SHORT_NODE; // The Wireless Node associated with a short press of Button 1 on a base station with buttons + static const EepromLocation BUTTON2_LONG_FUNC; // The function for a long press of Button 2 on a base station with buttons + static const EepromLocation BUTTON2_LONG_NODE; // The Wireless Node associated with a long press of Button 2 on a base station with buttons + static const EepromLocation BUTTON2_SHORT_FUNC; // The function for a short press of Button 2 on a base station with buttons + static const EepromLocation BUTTON2_SHORT_NODE; // The Wireless Node associated with a short press of Button 2 on a base station with buttons + static const EepromLocation LED_ACTION; // Controls the action of the LED on the base station + static const EepromLocation BAUD_RATE; // The baud rate of the serial connection with the base station + static const EepromLocation CYCLE_POWER; // Used to soft reset the base station + static const EepromLocation REGION_CODE; // The region code for the device. + static const EepromLocation ANALOG_EXCEED_MAX; // The maximum value for the Analog Exceedance setting + static const EepromLocation ANALOG_EXCEED_MIN; // The minimum value for the Analog Exceedance setting + static const EepromLocation ANALOG_EXCEED_ENABLE; // Enable/Disable analog exceedance static const EepromLocation MIN_SOFT_VER_MAJOR; //The minimum software version for support of this device (major). static const EepromLocation MIN_SOFT_VER_MINOR; //The minimum software version for support of this device (minor). }; diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromHelper.cpp b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromHelper.cpp index 7ecac608c..57fe22f30 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromHelper.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromHelper.cpp @@ -104,6 +104,37 @@ namespace mscl } } + Version NodeEepromHelper::read_asppVersion() const + { + uint16 asppValue = 0; + + try + { + //read the ASPP vesrion eeprom + asppValue = read(NodeEepromMap::ASPP_VER).as_uint16(); + } + catch(Error_NotSupported&) + { + //if the eeprom isn't supported, just leave it as 0 + //which will then fall back to the firmware version to + //determine the ASPP version number + } + + //if the aspp version is uninitialized + if(asppValue == 0xFFFF || asppValue == 0xAAAA || asppValue == 0) + { + Version fwVersion = read_fwVersion(); + + //convert the firmware version of the ASPP version + return WirelessProtocol::asppVersionFromNodeFw(fwVersion); + } + else + { + //ASPP version is good in eeprom, just return that version number + return Version(Utils::msb(asppValue), Utils::lsb(asppValue)); + } + } + WirelessModels::NodeModel NodeEepromHelper::read_model() const { //read the model number from eeprom diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromHelper.h b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromHelper.h index 4b1d98251..cf5ff49c0 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromHelper.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromHelper.h @@ -138,6 +138,18 @@ namespace mscl // - : A connection error has occurred with the parent BaseStation. Version read_fwVersion() const; + //Function: read_asppVersion + // Gets the ASPP version of the Node. + // + //Returns: + // A representing which ASPP version the Node supports. + // + //Exceptions: + // - : Unsupported eeprom location. + // - : Failed to read the value from the Node. + // - : A connection error has occurred with the parent BaseStation. + Version read_asppVersion() const; + //Function: read_model // Gets the model of the Node. // diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromMap.cpp b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromMap.cpp index f94a8b425..e888d5baf 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromMap.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromMap.cpp @@ -47,6 +47,7 @@ namespace mscl const EepromLocation NodeEepromMap::MAX_MEMORY (116, valueType_uint16); const EepromLocation NodeEepromMap::MICROCONTROLLER (120, valueType_uint16); const EepromLocation NodeEepromMap::FW_ARCH_VER (122, valueType_uint16); + const EepromLocation NodeEepromMap::ASPP_VER (124, valueType_uint16); const EepromLocation NodeEepromMap::HW_GAIN_1 (128, valueType_uint16); const EepromLocation NodeEepromMap::HW_GAIN_2 (130, valueType_uint16); const EepromLocation NodeEepromMap::HW_GAIN_3 (132, valueType_uint16); diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromMap.h b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromMap.h index c5e9e4888..66e600275 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromMap.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/Configuration/NodeEepromMap.h @@ -105,6 +105,7 @@ namespace mscl // MAX_MEMORY - The maximum number of pages available on the flash memory // MICROCONTROLLER - The ID of the microcontroller // FW_ARCH_VER - The firmware architecture version + // ASPP_VER - The ASPP version the node supports // HW_GAIN_1 - The hardware gain of channel 1 // HW_GAIN_2 - The hardware gain of channel 2 // HW_GAIN_3 - The hardware gain of channel 3 @@ -280,6 +281,7 @@ namespace mscl static const EepromLocation MAX_MEMORY; static const EepromLocation MICROCONTROLLER; static const EepromLocation FW_ARCH_VER; + static const EepromLocation ASPP_VER; static const EepromLocation HW_GAIN_1; static const EepromLocation HW_GAIN_2; static const EepromLocation HW_GAIN_3; diff --git a/MSCL/source/mscl/MicroStrain/Wireless/DatalogDownloader.cpp b/MSCL/source/mscl/MicroStrain/Wireless/DatalogDownloader.cpp index 6fa6f4fca..270613fd1 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/DatalogDownloader.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/DatalogDownloader.cpp @@ -355,100 +355,116 @@ namespace mscl throw Error_NoData("There is no more data available to download from the Node."); } - //check if the next group of bytes look like the start of a trigger - if(m_nodeMemory->isNextByteNewHeader()) + const uint32 startReadIndex = m_nodeMemory->readIndex(); + ChannelData chData; + + try { - //Download Version 1 - if(m_datalogDownloadVersion == 1) + //check if the next group of bytes look like the start of a trigger + if(m_nodeMemory->isNextByteNewHeader()) { - //parse the trigger header and update all of the trigger session info - parseTriggerHeader_v1(); + //Download Version 1 + if(m_datalogDownloadVersion == 1) + { + //parse the trigger header and update all of the trigger session info + parseTriggerHeader_v1(); - m_foundFirstTrigger = true; + m_foundFirstTrigger = true; + } + //Download Version 2 + else + { + //parse the trigger header for v2 and update any new trigger session info + parseTriggerHeader_v2(); + + m_foundFirstTrigger = true; + } } - //Download Version 2 else { - //parse the trigger header for v2 and update any new trigger session info - parseTriggerHeader_v2(); + //if the first trigger hasn't been found yet + if(!m_foundFirstTrigger) + { + //the start of trigger isn't at the first memory location on the Node + m_outOfMemory = true; + throw Error_NoData("No triggers were found on the Node."); + } - m_foundFirstTrigger = true; - } - } - else - { - //if the first trigger hasn't been found yet - if(!m_foundFirstTrigger) - { - //the start of trigger isn't at the first memory location on the Node - m_outOfMemory = true; - throw Error_NoData("No triggers were found on the Node."); + //set the startOfTrigger flag to false + m_sessionInfo.startOfTrigger = false; } - //set the startOfTrigger flag to false - m_sessionInfo.startOfTrigger = false; - } + uint8 lastActiveCh = m_sessionInfo.activeChannels.lastChEnabled(); - ChannelData chData; - - uint8 lastActiveCh = m_sessionInfo.activeChannels.lastChEnabled(); - - Utils::Endianness dataEndian = Utils::bigEndian; - if(m_datalogDownloadVersion == 2) - { - dataEndian = Utils::littleEndian; - } + Utils::Endianness dataEndian = Utils::bigEndian; + if(m_datalogDownloadVersion == 2) + { + dataEndian = Utils::littleEndian; + } - //calibrations are applied if floating point data - m_sessionInfo.calsApplied = (m_sessionInfo.dataType == WirelessTypes::dataType_float32); + //calibrations are applied if floating point data + m_sessionInfo.calsApplied = (m_sessionInfo.dataType == WirelessTypes::dataType_float32); - //loop through all the channels - for(uint8 chItr = 1; chItr <= lastActiveCh; ++chItr) - { - //if the current channel is enabled - if(m_sessionInfo.activeChannels.enabled(chItr)) + //loop through all the channels + for(uint8 chItr = 1; chItr <= lastActiveCh; ++chItr) { - anyType dataPoint; - - switch(m_sessionInfo.dataType) + //if the current channel is enabled + if(m_sessionInfo.activeChannels.enabled(chItr)) { - //4 byte float - case WirelessTypes::dataType_float32: - case WirelessTypes::dataType_float32_noCals: - dataPoint = m_nodeMemory->read_float(dataEndian); - break; - - //uint32 - case WirelessTypes::dataType_uint32: - dataPoint = m_nodeMemory->read_uint32(dataEndian); - break; - - //uint24 (get as a uint32) - case WirelessTypes::dataType_uint24: - dataPoint = m_nodeMemory->read_uint24(dataEndian); - break; - - //uint16 (from a 18-bit device, shift bits) - case WirelessTypes::dataType_uint16_18bitTrunc: + anyType dataPoint; + + switch(m_sessionInfo.dataType) { - uint32 val = m_nodeMemory->read_uint16(dataEndian); - dataPoint = (val << 2); - break; + //4 byte float + case WirelessTypes::dataType_float32: + case WirelessTypes::dataType_float32_noCals: + dataPoint = m_nodeMemory->read_float(dataEndian); + break; + + //uint32 + case WirelessTypes::dataType_uint32: + dataPoint = m_nodeMemory->read_uint32(dataEndian); + break; + + //uint24 (get as a uint32) + case WirelessTypes::dataType_uint24: + dataPoint = m_nodeMemory->read_uint24(dataEndian); + break; + + //uint16 (from a 18-bit device, shift bits) + case WirelessTypes::dataType_uint16_18bitTrunc: + { + uint32 val = m_nodeMemory->read_uint16(dataEndian); + dataPoint = (val << 2); + break; + } + + //uint16 + case WirelessTypes::dataType_uint16_shifted: + case WirelessTypes::dataType_uint16_12bitRes: + case WirelessTypes::dataType_uint16: + default: + dataPoint = m_nodeMemory->read_uint16(dataEndian); + break; } - //uint16 - case WirelessTypes::dataType_uint16_shifted: - case WirelessTypes::dataType_uint16_12bitRes: - case WirelessTypes::dataType_uint16: - default: - dataPoint = m_nodeMemory->read_uint16(dataEndian); - break; + //create a WirelessDataPoint and add it to the ChannelData vector + chData.push_back(WirelessDataPoint(static_cast(chItr), chItr, m_sessionInfo.valueType, dataPoint)); } - - //create a WirelessDataPoint and add it to the ChannelData vector - chData.push_back(WirelessDataPoint(static_cast(chItr), chItr, m_sessionInfo.valueType, dataPoint)); } } + catch(Error_Communication&) + { + //downloader v1 needs to reset the memory position on comm failure + if(m_datalogDownloadVersion == 1) + { + //set the read address back so that we the user can retry + m_nodeMemory->setAddress(startReadIndex); + } + + //then rethrow the exception + throw; + } //calculate the timestamp and tick for the sweep uint64 sweepTime = m_sessionInfo.timestamp + (m_sessionInfo.timeBetweenSweeps * m_sweepCount); diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Features/BaseStationFeatures.cpp b/MSCL/source/mscl/MicroStrain/Wireless/Features/BaseStationFeatures.cpp index bb0ce7771..efe9fa5f9 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Features/BaseStationFeatures.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/Features/BaseStationFeatures.cpp @@ -22,7 +22,7 @@ namespace mscl std::unique_ptr BaseStationFeatures::create(BaseStationInfo& info) { - switch(info.model) + switch(info.model()) { case WirelessModels::base_wsdaBase_104_usb: return std::unique_ptr(new BaseStationFeatures_usb(info)); @@ -43,7 +43,7 @@ namespace mscl default: //we don't know anything about this node, throw an exception - throw Error_NotSupported("The BaseStation model (" + Utils::toStr(info.model) + ") is not supported by MSCL."); + throw Error_NotSupported("The BaseStation model (" + Utils::toStr(info.model()) + ") is not supported by MSCL."); } } @@ -70,14 +70,14 @@ namespace mscl { static const Version MIN_BEACON_STATUS_FW(4, 0); - return (m_baseInfo.firmwareVersion >= MIN_BEACON_STATUS_FW); + return (m_baseInfo.firmwareVersion() >= MIN_BEACON_STATUS_FW); } bool BaseStationFeatures::supportsRfSweepMode() const { static const Version MIN_RF_SWEEP_FW(4, 30448); - return (m_baseInfo.firmwareVersion >= MIN_RF_SWEEP_FW); + return (m_baseInfo.firmwareVersion() >= MIN_RF_SWEEP_FW); } uint8 BaseStationFeatures::analogPortCount() const @@ -95,7 +95,7 @@ namespace mscl WirelessTypes::TransmitPowers result; //find the max transmit power for the node's region code - WirelessTypes::TransmitPower maxPower = WirelessTypes::maxTransmitPower(m_baseInfo.regionCode); + WirelessTypes::TransmitPower maxPower = WirelessTypes::maxTransmitPower(m_baseInfo.regionCode()); //add the power levels based on the max power we determined above if(maxPower >= WirelessTypes::power_20dBm && supportsNewTransmitPowers()) @@ -130,13 +130,13 @@ namespace mscl { static const Version MIN_NEW_TX_POWER_FW(4, 0); - return (m_baseInfo.firmwareVersion >= MIN_NEW_TX_POWER_FW); + return (m_baseInfo.firmwareVersion() >= MIN_NEW_TX_POWER_FW); } bool BaseStationFeatures::supportsEepromCommitViaRadioReset() const { static const Version MIN_EEPROM_COMMIT_RADIO_FW(4, 0); - return (m_baseInfo.firmwareVersion >= MIN_EEPROM_COMMIT_RADIO_FW); + return (m_baseInfo.firmwareVersion() >= MIN_EEPROM_COMMIT_RADIO_FW); } } \ No newline at end of file diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Features/FlashInfo.cpp b/MSCL/source/mscl/MicroStrain/Wireless/Features/FlashInfo.cpp index 789ca547c..90b396114 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Features/FlashInfo.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/Features/FlashInfo.cpp @@ -22,7 +22,7 @@ namespace mscl //Block Size: 64 KiB //Page Size: 256 Bytes //Max Bandwidth: 65535 ?? - return FlashInfo((4 * 1049000), (64 * 1024), 256, 65535); + return FlashInfo((4 * 1024 * 1024), (64 * 1024), 256, 65535); } FlashInfo FlashInfo::FLASH_IS25WP128() @@ -31,7 +31,7 @@ namespace mscl //Block Size: 64 KiB //Page Size: 256 Bytes //Max Bandwidth: 65535 - return FlashInfo((16 * 1049000), (64 * 1024), 256, 65535); + return FlashInfo((16 * 1024 * 1024), (64 * 1024), 256, 65535); } FlashInfo FlashInfo::FROM_FLASH_ID(uint16 flashId) diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeFeatures.cpp b/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeFeatures.cpp index f47936c89..2e2af900f 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeFeatures.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeFeatures.cpp @@ -55,7 +55,7 @@ namespace mscl } const Version NodeFeatures::MIN_NODE_FW_PROTOCOL_1_5(10, 33392); - const Version NodeFeatures::MIN_NODE_FW_PORTOCOL_1_4(10, 31758); + const Version NodeFeatures::MIN_NODE_FW_PROTOCOL_1_4(10, 31758); const Version NodeFeatures::MIN_NODE_FW_PROTOCOL_1_2(10, 0); const Version NodeFeatures::MIN_NODE_FW_PROTOCOL_1_1(8, 21); diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeFeatures.h b/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeFeatures.h index edec69aab..6920dfb6e 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeFeatures.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeFeatures.h @@ -44,7 +44,7 @@ namespace mscl private: //Wireless Node FW version to ASPP version lookup static const Version MIN_NODE_FW_PROTOCOL_1_5; - static const Version MIN_NODE_FW_PORTOCOL_1_4; + static const Version MIN_NODE_FW_PROTOCOL_1_4; static const Version MIN_NODE_FW_PROTOCOL_1_2; static const Version MIN_NODE_FW_PROTOCOL_1_1; diff --git a/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeInfo.cpp b/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeInfo.cpp index 9978d5db6..a9e3864fb 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeInfo.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/Features/NodeInfo.cpp @@ -12,10 +12,6 @@ namespace mscl //read the required information from the node and store in the NodeInfo NodeInfo::NodeInfo(const WirelessNode_Impl* node): m_node(node) - /*m_firmwareVersion(node.firmwareVersion()), - m_model(node.model()), - m_dataStorageSize(node.dataStorageSize()), - m_regionCode(node.regionCode())*/ { } diff --git a/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory.h b/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory.h index 1748b48f2..0e45fffe7 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory.h @@ -75,6 +75,13 @@ namespace mscl // Returns the current read index for the data. virtual uint32 readIndex() const = 0; + //Function: setAddress + // Sets the read address to the specified value. + // + //Parameters: + // newAddress - The address to set the read address to. + virtual void setAddress(uint32 newAddress) = 0; + //Function: bytesRemaining // Calculates how many bytes are remaining in the Node's datalogging memory, based on the current byte position. // diff --git a/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v1.h b/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v1.h index b17de5504..e47e102cc 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v1.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v1.h @@ -110,13 +110,6 @@ namespace mscl // - : A connection error has occurred. void findData(uint32 bytePosition, ByteStream** data, uint16& offset); - //Function: setAddress - // Sets the read address to the specified value. - // - //Parameters: - // newAddress - The address to set the read address to. - void setAddress(uint32 newAddress); - protected: //Function: nextByte // Reads the next byte from the datalogging data. @@ -143,6 +136,13 @@ namespace mscl // Returns the current read index for the data. virtual uint32 readIndex() const override; + //Function: setAddress + // Sets the read address to the specified value. + // + //Parameters: + // newAddress - The address to set the read address to. + virtual void setAddress(uint32 newAddress) override; + //Function: bytesRemaining // Calculates how many bytes are remaining in the Node's datalogging memory, based on the given byte position. // diff --git a/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v2.cpp b/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v2.cpp index 28ee2890b..898ec1d7f 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v2.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v2.cpp @@ -352,6 +352,13 @@ namespace mscl return m_readIndex; } + void NodeMemory_v2::setAddress(uint32 newAddress) + { + //setAddress is not supported by NodeMemory_v2! (TODO?) + assert(false); + return; + } + uint32 NodeMemory_v2::bytesRemaining() { size_t bytesLeftToRead = m_nextData.size() + diff --git a/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v2.h b/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v2.h index 808c90344..fb83e7562 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v2.h +++ b/MSCL/source/mscl/MicroStrain/Wireless/NodeMemory_v2.h @@ -170,6 +170,13 @@ namespace mscl // Returns the current read index for the data. virtual uint32 readIndex() const override; + //Function: setAddress + // Sets the read address to the specified value. + // + //Parameters: + // newAddress - The address to set the read address to. + virtual void setAddress(uint32 newAddress) override; + //Function: bytesRemaining // Calculates how many bytes are remaining in the Node's datalogging memory, based on the current byte position. // diff --git a/MSCL/source/mscl/MicroStrain/Wireless/SyncSamplingNetwork.cpp b/MSCL/source/mscl/MicroStrain/Wireless/SyncSamplingNetwork.cpp index c1bba2bed..45605aa83 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/SyncSamplingNetwork.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/SyncSamplingNetwork.cpp @@ -247,7 +247,7 @@ namespace mscl void SyncSamplingNetwork::applyConfiguration() { - static const uint8 LEGACY_MODE_TDMA_OFFSET = 3; + static const uint8 LEGACY_MODE_TDMA_OFFSET = 4; //loop through each configuration for(auto &nodeItr : m_nodes) diff --git a/MSCL/source/mscl/MicroStrain/Wireless/WirelessNode_Impl.cpp b/MSCL/source/mscl/MicroStrain/Wireless/WirelessNode_Impl.cpp index d3b31e1e5..bf8d9a79d 100644 --- a/MSCL/source/mscl/MicroStrain/Wireless/WirelessNode_Impl.cpp +++ b/MSCL/source/mscl/MicroStrain/Wireless/WirelessNode_Impl.cpp @@ -31,10 +31,11 @@ namespace mscl std::unique_ptr WirelessNode_Impl::determineProtocol() const { - Version fwVersion; + Version asppVersion; NodeEepromSettings tempSettings = m_eepromSettings; tempSettings.numRetries = 0; + tempSettings.useGroupRead = false; bool success = false; uint8 retryCount = 0; @@ -45,18 +46,18 @@ 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(); //set the NodeEeprom with the temporary protocol m_eeprom.reset(new NodeEeprom(m_address, m_baseStation, *(m_protocol.get()), tempSettings)); - fwVersion = firmwareVersion(); + asppVersion = m_eepromHelper->read_asppVersion(); success = true; } catch(Error_Communication&) { - //Failed reading with protocol v1.1 - Now try v1.0 + //Failed reading with protocol v1.1 - Now try v1.0 (has read eeprom v1) //we know this uses the same group read (page download) as the previous protocol, so skip it tempSettings.useGroupRead = false; @@ -69,7 +70,7 @@ namespace mscl //set the NodeEeprom with the temporary protocol m_eeprom.reset(new NodeEeprom(m_address, m_baseStation, *(m_protocol.get()), tempSettings)); - fwVersion = firmwareVersion(); + asppVersion = m_eepromHelper->read_asppVersion(); success = true; } catch(Error_Communication&) @@ -91,8 +92,8 @@ namespace mscl } while(!success && (retryCount++ < m_eepromSettings.numRetries)); - //get the protocol to use for the node's fw version - return WirelessProtocol::chooseNodeProtocol(fwVersion); + //get the protocol to use for the node + return WirelessProtocol::getProtocol(asppVersion); } NodeEeprom& WirelessNode_Impl::eeprom() const @@ -220,7 +221,19 @@ namespace mscl //don't need to clear anything if it doesn't exist if(m_eeprom != NULL) { - eeprom().clearCache(); + m_eeprom.reset(); + } + + //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(); } } diff --git a/MSCL_Managed/Properties/AssemblyInfo.cs b/MSCL_Managed/Properties/AssemblyInfo.cs index 8b377762c..ce2d4c0c4 100644 --- a/MSCL_Managed/Properties/AssemblyInfo.cs +++ b/MSCL_Managed/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ // [assembly: AssemblyVersion("1.0.*")] // //update with each release -[assembly: AssemblyVersion("13.0.2.0")] -[assembly: AssemblyFileVersion("13.0.2.0")] +[assembly: AssemblyVersion("13.1.1.0")] +[assembly: AssemblyFileVersion("13.1.1.0")] diff --git a/MSCL_Unit_Tests/Test_BaseStation.cpp b/MSCL_Unit_Tests/Test_BaseStation.cpp index 8b60396a2..8450950db 100644 --- a/MSCL_Unit_Tests/Test_BaseStation.cpp +++ b/MSCL_Unit_Tests/Test_BaseStation.cpp @@ -240,20 +240,6 @@ BOOST_AUTO_TEST_CASE(BaseStation_changeFrequency_success) BOOST_CHECK_EQUAL(base.frequency(), WirelessTypes::freq_14); } -BOOST_AUTO_TEST_CASE(BaseStation_changeFrequency_fail) -{ - std::shared_ptr connImpl(new mockConnectionImpl); - Connection conn(connImpl); - - //create the base station (loads the info) - BaseStation base(conn, 1); - - BOOST_CHECK_THROW(base.changeFrequency(WirelessTypes::freq_14), Error); - - connImpl->setResponseBytes(loadBaseInfoResponse()); - BOOST_CHECK_EQUAL(base.frequency(), WirelessTypes::freq_13); //verify that it didn't change frequencies -} - BOOST_AUTO_TEST_SUITE(BaseStation_Test_NodeCommands) BOOST_AUTO_TEST_CASE(BaseStation_NodeLongPing_Success) diff --git a/MSCL_Unit_Tests/Test_BaseStationConfig.cpp b/MSCL_Unit_Tests/Test_BaseStationConfig.cpp index ba1b9a6b7..00d04d426 100644 --- a/MSCL_Unit_Tests/Test_BaseStationConfig.cpp +++ b/MSCL_Unit_Tests/Test_BaseStationConfig.cpp @@ -211,6 +211,7 @@ BOOST_AUTO_TEST_CASE(BaseStationConfig_legacyTransmitPower) //expect the single eeprom write expectWrite(impl, BaseStationEepromMap::TX_POWER_LEVEL, Value(valueType_int16, (int16)WirelessTypes::legacyPower_10dBm)); + expectRead(impl, BaseStationEepromMap::ASPP_VER, Value::UINT16((0))); expectRead(impl, BaseStationEepromMap::FIRMWARE_VER, Value::UINT16((uint16)(3))); expectRead(impl, BaseStationEepromMap::FIRMWARE_VER2, Value::UINT16((uint16)(2))); expectCyclePower(impl); diff --git a/MSCL_Unit_Tests/Test_DatalogDownloader.cpp b/MSCL_Unit_Tests/Test_DatalogDownloader.cpp index 5d7f597a0..66a75f9ee 100644 --- a/MSCL_Unit_Tests/Test_DatalogDownloader.cpp +++ b/MSCL_Unit_Tests/Test_DatalogDownloader.cpp @@ -46,6 +46,7 @@ BOOST_AUTO_TEST_CASE(DatalogDownloader_getNextData_v1_0) uint16 page = 0, offset = 44; MOCK_EXPECT(impl->firmwareVersion).returns(Version(8, 0)); + MOCK_EXPECT(impl->readEeprom).with(NodeEepromMap::ASPP_VER).returns(Value::UINT16(0x0105)); MOCK_EXPECT(impl->readEeprom).with(NodeEepromMap::CURRENT_LOG_PAGE).returns(Value::UINT16(page));//log page MOCK_EXPECT(impl->readEeprom).with(NodeEepromMap::CURRENT_PAGE_OFFSET).returns(Value::UINT16(offset));//page offset @@ -122,6 +123,7 @@ BOOST_AUTO_TEST_CASE(DatalogDownloader_getNextData_v2_0) uint16 page = 0, offset = 46; MOCK_EXPECT(impl->firmwareVersion).returns(Version(8, 0)); + MOCK_EXPECT(impl->readEeprom).with(NodeEepromMap::ASPP_VER).returns(Value::UINT16(0x0105)); MOCK_EXPECT(impl->readEeprom).with(NodeEepromMap::CURRENT_LOG_PAGE).returns(Value::UINT16(page));//log page MOCK_EXPECT(impl->readEeprom).with(NodeEepromMap::CURRENT_PAGE_OFFSET).returns(Value::UINT16(offset));//page offset @@ -205,6 +207,7 @@ BOOST_AUTO_TEST_CASE(DatalogDownloader_getNextData_v2_1) uint16 page = 0, offset = 46; MOCK_EXPECT(impl->firmwareVersion).returns(Version(8, 0)); + MOCK_EXPECT(impl->readEeprom).with(NodeEepromMap::ASPP_VER).returns(Value::UINT16(0x0105)); MOCK_EXPECT(impl->readEeprom).with(NodeEepromMap::CURRENT_LOG_PAGE).returns(Value::UINT16(page));//log page MOCK_EXPECT(impl->readEeprom).with(NodeEepromMap::CURRENT_PAGE_OFFSET).returns(Value::UINT16(offset));//page offset diff --git a/MSCL_Unit_Tests/Test_WirelessNode.cpp b/MSCL_Unit_Tests/Test_WirelessNode.cpp index 1840e1c49..18b396c35 100644 --- a/MSCL_Unit_Tests/Test_WirelessNode.cpp +++ b/MSCL_Unit_Tests/Test_WirelessNode.cpp @@ -120,6 +120,8 @@ BOOST_AUTO_TEST_CASE(WirelessNode_readEepromuint16_pageDownload) data.append_uint16(45); //eeprom 8 data.append_uint16(1); //eeprom 10 + MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 124, mock::assign(0x0105)).returns(true); + //force the page download to take our bytestream MOCK_EXPECT(impl->node_pageDownload).with(mock::any, mock::any, mock::any, mock::assign(data)).returns(true); @@ -145,7 +147,7 @@ BOOST_AUTO_TEST_CASE(WirelessNode_readEepromuint16_read) uint16 eepromVal = 876; - MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 108, mock::assign(1)).returns(true); + MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 124, mock::assign(0x0105)).returns(true); //force the read eeprom to return our response MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, mock::any, mock::assign(eepromVal)).returns(true); @@ -169,7 +171,7 @@ BOOST_AUTO_TEST_CASE(WirelessNode_writeEepromuint16) //force the page download to fail MOCK_EXPECT(impl->node_pageDownload).returns(false); - MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 108, mock::assign(1)).returns(true); + MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 124, mock::assign(0x0105)).returns(true); //force the read eeprom to return our response MOCK_EXPECT(impl->node_writeEeprom).once().returns(true); @@ -285,7 +287,7 @@ BOOST_AUTO_TEST_CASE(WirelessNode_frequency) //force the page download to fail MOCK_EXPECT(impl->node_pageDownload).returns(false); - MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 108, mock::assign(1)).returns(true); + MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 124, mock::assign(0x0105)).returns(true); MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 90, mock::assign(16)).returns(true); BOOST_CHECK_EQUAL(node.frequency(), WirelessTypes::freq_16); @@ -748,7 +750,7 @@ BOOST_AUTO_TEST_CASE(WirelessNode_erase) WirelessNode node(123, base); MOCK_EXPECT(impl->node_pageDownload).returns(false); - MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 108, mock::assign(9)).returns(true); + MOCK_EXPECT(impl->node_readEeprom).once().with(mock::any, mock::any, 124, mock::assign(0x0105)).returns(true); MOCK_EXPECT(impl->node_erase).once().returns(true);