Skip to content

Commit

Permalink
Various platform fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eberseth committed Sep 21, 2024
1 parent ffdbd78 commit 09cc349
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/EdgePlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ EdgePlatform *EdgePlatform::_instance = nullptr;

Logger EdgePlatformLogger("otp");

void EdgePlatform::init()
void EdgePlatform::init(uint32_t model, uint32_t variant)
{
#ifdef TRACKER_HAS_HW_INFO
hal_device_hw_info info;
uint32_t res;

Expand All @@ -77,8 +78,13 @@ void EdgePlatform::init()
uint8_t byte2 = info.features & 0xFF;
uint8_t byte3 = info.features >> 8;

#else // TRACKER_HAS_HW_INFO
uint8_t byte2 = 0xFF;
uint8_t byte3 = 0xFF;
#endif // TRACKER_HAS_HW_INFO

// Parse OTP area to determine module type
switch (info.model) {
switch (model) {
case TRACKER_MODEL_BARE_SOM:
model_ = TrackerModel::eBARE_SOM;
break;
Expand Down
4 changes: 3 additions & 1 deletion src/EdgePlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ class EdgePlatform
/**
* @brief Read OTP region for hardware information
*
* @param model Model info from non-volatile memory
* @param variant Variant info from non-volatile memory
*/
void init();
void init(uint32_t model, uint32_t variant);

/**
* @brief Return Tracker model type
Expand Down
4 changes: 1 addition & 3 deletions src/tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,10 @@ int Tracker::init()
_model = TRACKER_MODEL_NUMBER;
#ifdef TRACKER_MODEL_VARIANT
_variant = TRACKER_MODEL_VARIANT;
#else
_variant = 0;
#endif // TRACKER_MODEL_VARIANT
#endif // TRACKER_MODEL_NUMBER

EdgePlatform::instance().init();
EdgePlatform::instance().init(_model, _variant);
switch (EdgePlatform::instance().getModel()) {
case EdgePlatform::TrackerModel::eTRACKER_ONE:
_platformConfig = new TrackerOneConfiguration();
Expand Down
4 changes: 4 additions & 0 deletions src/tracker_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
#define TRACKER_PRODUCT_VERSION (119)
#endif

#if ( SYSTEM_VERSION >= SYSTEM_VERSION_DEFAULT(4, 0, 0) )
#define TRACKER_HAS_HW_INFO
#endif // SYSTEM_VERSION

#if ( (SYSTEM_VERSION < SYSTEM_VERSION_ALPHA(5, 0, 0, 1)) && (PLATFORM_ID == PLATFORM_TRACKER) )
#define TRACKER_USE_MEMFAULT
#endif // SYSTEM_VERSION
Expand Down

0 comments on commit 09cc349

Please sign in to comment.