Skip to content

Commit

Permalink
added $GI
Browse files Browse the repository at this point in the history
  • Loading branch information
lincomatic committed Nov 19, 2021
1 parent dd134b2 commit b035a34
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
3 changes: 3 additions & 0 deletions firmware/open_evse/CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 4 additions & 1 deletion firmware/open_evse/open_evse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
31 changes: 31 additions & 0 deletions firmware/open_evse/rapi_proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
const char RAPI_VER[] PROGMEM = RAPIVER;


#ifdef MCU_ID_LEN
// mcuid *must* be of size MCU_ID_LEN
#include <avr/boot.h>
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)
{
Expand Down Expand Up @@ -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]));
Expand Down
11 changes: 10 additions & 1 deletion firmware/open_evse/rapi_proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b035a34

Please sign in to comment.