Skip to content

Commit 09cc349

Browse files
Eric Bersetheberseth
Eric Berseth
authored andcommitted
Various platform fixes
1 parent ffdbd78 commit 09cc349

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/EdgePlatform.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ EdgePlatform *EdgePlatform::_instance = nullptr;
6464

6565
Logger EdgePlatformLogger("otp");
6666

67-
void EdgePlatform::init()
67+
void EdgePlatform::init(uint32_t model, uint32_t variant)
6868
{
69+
#ifdef TRACKER_HAS_HW_INFO
6970
hal_device_hw_info info;
7071
uint32_t res;
7172

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

81+
#else // TRACKER_HAS_HW_INFO
82+
uint8_t byte2 = 0xFF;
83+
uint8_t byte3 = 0xFF;
84+
#endif // TRACKER_HAS_HW_INFO
85+
8086
// Parse OTP area to determine module type
81-
switch (info.model) {
87+
switch (model) {
8288
case TRACKER_MODEL_BARE_SOM:
8389
model_ = TrackerModel::eBARE_SOM;
8490
break;

src/EdgePlatform.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ class EdgePlatform
102102
/**
103103
* @brief Read OTP region for hardware information
104104
*
105+
* @param model Model info from non-volatile memory
106+
* @param variant Variant info from non-volatile memory
105107
*/
106-
void init();
108+
void init(uint32_t model, uint32_t variant);
107109

108110
/**
109111
* @brief Return Tracker model type

src/tracker.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,10 @@ int Tracker::init()
568568
_model = TRACKER_MODEL_NUMBER;
569569
#ifdef TRACKER_MODEL_VARIANT
570570
_variant = TRACKER_MODEL_VARIANT;
571-
#else
572-
_variant = 0;
573571
#endif // TRACKER_MODEL_VARIANT
574572
#endif // TRACKER_MODEL_NUMBER
575573

576-
EdgePlatform::instance().init();
574+
EdgePlatform::instance().init(_model, _variant);
577575
switch (EdgePlatform::instance().getModel()) {
578576
case EdgePlatform::TrackerModel::eTRACKER_ONE:
579577
_platformConfig = new TrackerOneConfiguration();

src/tracker_config.h

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
#define TRACKER_PRODUCT_VERSION (119)
5050
#endif
5151

52+
#if ( SYSTEM_VERSION >= SYSTEM_VERSION_DEFAULT(4, 0, 0) )
53+
#define TRACKER_HAS_HW_INFO
54+
#endif // SYSTEM_VERSION
55+
5256
#if ( (SYSTEM_VERSION < SYSTEM_VERSION_ALPHA(5, 0, 0, 1)) && (PLATFORM_ID == PLATFORM_TRACKER) )
5357
#define TRACKER_USE_MEMFAULT
5458
#endif // SYSTEM_VERSION

0 commit comments

Comments
 (0)