diff --git a/ATM90E32.cpp b/ATM90E32.cpp index aa77309..aa9671d 100644 --- a/ATM90E32.cpp +++ b/ATM90E32.cpp @@ -41,7 +41,7 @@ unsigned short ATM90E32::CommEnergyIC(unsigned char RW, unsigned short address, #endif #if defined(ESP8266) - SPISettings settings(200000, MSBFIRST, SPI_MODE2); + SPISettings settings(200000, MSBFIRST, SPI_MODE1); #endif #if defined(ESP32) @@ -443,7 +443,7 @@ void ATM90E32::begin(int pin, unsigned short lineFreq, unsigned short pgagain, u /* Enable SPI */ SPI.begin(); - + Serial.println("Connecting to ATM90E32"); #if defined(ENERGIA) SPI.setBitOrder(MSBFIRST); @@ -457,7 +457,7 @@ void ATM90E32::begin(int pin, unsigned short lineFreq, unsigned short pgagain, u unsigned short sagV; unsigned short FreqHiThresh; unsigned short FreqLoThresh; - if (_lineFreq == 4485 || _lineFreq == 5231) + if (_lineFreq == 4485 || _lineFreq == 4231) { sagV = 90; FreqHiThresh = 61 * 100; @@ -536,4 +536,4 @@ void ATM90E32::begin(int pin, unsigned short lineFreq, unsigned short pgagain, u CommEnergyIC(WRITE, IoffsetC, 0x0000); // 6C C line current offset CommEnergyIC(WRITE, CfgRegAccEn, 0x0000); // 7F end configuration -} \ No newline at end of file +} diff --git a/ATM90E32.h b/ATM90E32.h index 1f37549..73fc10e 100644 --- a/ATM90E32.h +++ b/ATM90E32.h @@ -159,8 +159,8 @@ The MIT License (MIT) #define ANenergyCH 0xAF // C Reverse Harm. Energy /* POWER & P.F. REGISTERS */ -#define PmeanA 0xB1 // A Mean Power (P) #define PmeanT 0xB0 // Total Mean Power (P) +#define PmeanA 0xB1 // A Mean Power (P) #define PmeanB 0xB2 // B Mean Power (P) #define PmeanC 0xB3 // C Mean Power (P) #define QmeanT 0xB4 // Total Mean Power (Q) diff --git a/README.md b/README.md index ee5fe04..ff9b939 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ The following are other functions for other metering data that the ATM90E32 calc - GetTemperature() //chip temperature ### Getting Energy Over Time -The following functions get data from the ATM90E32 that is converted to kWh +The following functions get data from the ATM90E32 that is converted to kWh. The registers are cleared once they are read. - GetImportEnergy() //forward active energy - GetImportReactiveEnergy() - GetImportApparentEnergy() diff --git a/library.json b/library.json index 2ab3147..7b19f4d 100644 --- a/library.json +++ b/library.json @@ -1,12 +1,12 @@ { "name": "ATM90E32", - "keywords": "energy meter, circuitsetup", - "description": "Arduino library for energy meters that use the ATM90E32 IC from Microchip/Atmel", + "keywords": "energy meter, circuitsetup, spi, sensor, iot", + "description": "Arduino library for energy meters that use the ATM90E32AS IC from Microchip/Atmel", "repository": { "type": "git", "url": "https://github.com/CircuitSetup/ATM90E32.git" }, - "version": "1.0.0", + "version": "1.1.0", "authors": [ { @@ -20,5 +20,5 @@ } ], "frameworks": "arduino", - "platforms": "*" + "platforms": ["espressif8266", "espressif32", "atmelsam", "atmelmegaavr", "atmelavr"] }