diff --git a/firmware/open_evse/CHANGELOG b/firmware/open_evse/CHANGELOG index 0b3bb708..f0f47843 100644 --- a/firmware/open_evse/CHANGELOG +++ b/firmware/open_evse/CHANGELOG @@ -1,5 +1,8 @@ Change Log +2021119 SCL V7.1.5 +- added RAPI $GI command to get AVR serial number. enable with MCU_ID_LEN + 20210911 SCL V7.1.4 - fixed minor bug.. temperature checking was only being done in STATE C. So if temperature dropped below the restore threshold after transition out of diff --git a/firmware/open_evse/open_evse.h b/firmware/open_evse/open_evse.h index c7f38366..97507738 100644 --- a/firmware/open_evse/open_evse.h +++ b/firmware/open_evse/open_evse.h @@ -41,7 +41,7 @@ #define clrBits(flags,bits) (flags &= ~(bits)) #ifndef VERSION -#define VERSION "D7.1.3" +#define VERSION "D7.1.5" #endif // !VERSION #include "Language_default.h" //Default language should always be included as bottom layer @@ -61,6 +61,9 @@ typedef unsigned long time_t; #define RELAY_HOLD_DELAY_TUNING // enable Z0 #endif // OEV6 +// enable $GI +#define MCU_ID_LEN 10 + // auto detect L1/L2 #define AUTOSVCLEVEL diff --git a/firmware/open_evse/rapi_proc.cpp b/firmware/open_evse/rapi_proc.cpp index 1230a536..83b4d83e 100644 --- a/firmware/open_evse/rapi_proc.cpp +++ b/firmware/open_evse/rapi_proc.cpp @@ -33,6 +33,18 @@ const char RAPI_VER[] PROGMEM = RAPIVER; +#ifdef MCU_ID_LEN +// mcuid *must* be of size MCU_ID_LEN +#include +void getMcuId(uint8_t *mcuid) +{ + for (int i=0;i < MCU_ID_LEN;i++) { + mcuid[i] = boot_signature_byte_get(0x0E + i); + } +} +#endif // MCU_ID_LEN + + // convert 2-digit hex string to uint8_t uint8_t htou8(const char *s) { @@ -462,6 +474,25 @@ int EvseRapiProcessor::processCmd() } break; #endif // CHARGE_LIMIT +#ifdef MCU_ID_LEN + case 'I': // get MCU ID + { + uint8_t mcuid[MCU_ID_LEN]; + getMcuId(mcuid); + char *s = buffer + strlen(buffer); + *(s++) = ' '; + for (int i=0;i < 6;i++) { + *(s++) = mcuid[i]; + } + for (int i=6;i < MCU_ID_LEN;i++) { + sprintf(s,"%02X",mcuid[i]); + s += 2; + } + bufCnt = 1; // flag response text output + rc = 0; + } + break; +#endif // MCU_ID_LEN #ifdef KWH_RECORDING case 'K': // set accumulated kwh g_EnergyMeter.SetTotkWh(dtou32(tokens[1])); diff --git a/firmware/open_evse/rapi_proc.h b/firmware/open_evse/rapi_proc.h index 296ebaea..7aaadad2 100644 --- a/firmware/open_evse/rapi_proc.h +++ b/firmware/open_evse/rapi_proc.h @@ -269,6 +269,15 @@ GH - get cHarge limit kWh = 0 = no charge limit $GH^2B +GI - get MCU ID - requires MCU_ID_LEN to be defined + response: $OK mcuid + mcuid: AVR serial number + mcuid is 6 ASCII characters followed by 4 hex digits + first hex digit = FF for 328P + WARNING: mcuid is guaranteed to be unique only for the 328PB. Uniqueness is + unknown in 328P. The first 6 characters are ASCII, and the rest are + hexadecimal. + GM - get voltMeter settings response: $OK voltcalefactor voltoffset $GM^2E @@ -333,7 +342,7 @@ Z0 closems holdpwm #ifdef RAPI -#define RAPIVER "5.1.3" +#define RAPIVER "5.1.4" #define WIFI_MODE_AP 0 #define WIFI_MODE_CLIENT 1