Skip to content

Commit

Permalink
fixup! 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 committed Nov 21, 2024
1 parent 8942cff commit 483a3b8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libraries/WiFiS3/src/WiFi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,21 @@ const char* CWifi::firmwareVersion() {
return "99.99.99";
}

/*
* 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 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] << 24| res[1] << 16 | res[2] << 8 | res[3];
return res[0] << 16| res[1] << 8 | res[2];
}
return 0x63636300;
return 0x636363;
}

/* -------------------------------------------------------------------------- */
Expand Down

0 comments on commit 483a3b8

Please sign in to comment.