Skip to content

Commit

Permalink
added possibility to get fw version of wifi module as uint32
Browse files Browse the repository at this point in the history
  • Loading branch information
andreagilardoni authored and pennam committed Nov 27, 2024
1 parent 9666fc2 commit af0787a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libraries/WiFiS3/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ const char* CWifi::firmwareVersion() {
return "99.99.99";
}

/* -------------------------------------------------------------------------- */
uint32_t CWifi::firmwareVersionU32() {
/* -------------------------------------------------------------------------- */
uint8_t ret[4];
string res = "";
modem.begin();
if(modem.write(string(PROMPT(_FWVERSION_U32)), res, CMD_READ(_FWVERSION_U32))) {
return res[0] << 16| res[1] << 8 | res[2];
}
return 0x636363;
}

/* -------------------------------------------------------------------------- */
int CWifi::begin(const char* ssid) {
/* -------------------------------------------------------------------------- */
Expand Down
8 changes: 8 additions & 0 deletions libraries/WiFiS3/src/WiFi.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ class CWifi {
* Get firmware version
*/
static const char* firmwareVersion();
/*
* Get firmware version U32
*
* Since version is made in a semver fashion, thus in an integer it will be represented as
* byte 1 (MSB) | byte 2 | byte 3 | byte 4
* 0 | MAJOR | MINOR | PATCH
*/
uint32_t firmwareVersionU32();

/*
* PING
Expand Down

0 comments on commit af0787a

Please sign in to comment.