bphermansson / EspSparsnasGateway

Reads data from Ikea Sparsnäs energy meter and publish via Mqtt.
MIT License
39 stars 27 forks source link

Cannot upload sketch to NodeMCU #16

Closed pornstrup closed 6 years ago

pornstrup commented 6 years ago

Im trying to upload your code to the NodeMCU v.3, but always get an error in arduino saying: call of overloaded 'readRSSI()' is ambiguous

and this line is marked red: uint16_t srssi = readRSSI(); I´ve downloaded the libraries needed but still get the error. Hope you can help, thanks.

Copy of error message:

Arduino: 1.8.5 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\EspSparsnasGateway.ino: In function 'void interruptHandler()':

EspSparsnasGateway:424: error: call of overloaded 'readRSSI()' is ambiguous

   uint16_t srssi = readRSSI();

                             ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\EspSparsnasGateway.ino:424:33: note: candidates are:

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino:45:10: note: uint16_t readRSSI()

uint16_t readRSSI() {

      ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\EspSparsnasGateway.ino:303:10: note: uint16_t readRSSI(bool)

uint16_t readRSSI(bool forceTrigger = false) { // Settings this to true gives a crash...

      ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino: In function 'uint32_t getFrequency()':

RFM69functions:1: error: redefinition of 'uint32_t getFrequency()'

uint32_t getFrequency() {

      ^

EspSparsnasGateway:268: error: 'uint32_t getFrequency()' previously defined here

uint32_t getFrequency() {

      ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino: In function 'void receiveBegin()':

RFM69functions:4: error: redefinition of 'void receiveBegin()'

void receiveBegin() {

  ^

EspSparsnasGateway:272: error: 'void receiveBegin()' previously defined here

void receiveBegin() {

  ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino: In function 'uint8_t readReg(uint8_t)':

RFM69functions:16: error: redefinition of 'uint8_t readReg(uint8_t)'

uint8_t readReg(uint8_t addr) {

     ^

EspSparsnasGateway:320: error: 'uint8_t readReg(uint8_t)' previously defined here

uint8_t readReg(uint8_t addr) {

     ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino: In function 'void writeReg(uint8_t, uint8_t)':

RFM69functions:24: error: redefinition of 'void writeReg(uint8_t, uint8_t)'

void writeReg(uint8_t addr, uint8_t value) {

  ^

EspSparsnasGateway:328: error: 'void writeReg(uint8_t, uint8_t)' previously defined here

void writeReg(uint8_t addr, uint8_t value) {

  ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino: In function 'void select()':

RFM69functions:32: error: redefinition of 'void select()'

void select() {

  ^

EspSparsnasGateway:336: error: 'void select()' previously defined here

void select() {

  ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino: In function 'void unselect()':

RFM69functions:38: error: redefinition of 'void unselect()'

void unselect() {

  ^

EspSparsnasGateway:342: error: 'void unselect()' previously defined here

void unselect() {

  ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino: In function 'uint16_t readRSSI()':

RFM69functions:56: error: 'rssi' was not declared in this scope

rssi = -readReg(REG_RSSIVALUE);

^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino: In function 'bool receiveDone()':

RFM69functions:64: error: redefinition of 'bool receiveDone()'

bool receiveDone() {

  ^

EspSparsnasGateway:284: error: 'bool receiveDone()' previously defined here

bool receiveDone() {

  ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\RFM69functions.ino: In function 'uint16_t crc16(volatile uint8_t*, size_t)':

RFM69functions:82: error: redefinition of 'uint16_t crc16(volatile uint8_t*, size_t)'

uint16_t crc16(volatile uint8_t *data, size_t n) {

      ^

EspSparsnasGateway:522: error: 'uint16_t crc16(volatile uint8_t*, size_t)' previously defined here

uint16_t crc16(volatile uint8_t *data, size_t n) {

      ^

C:\Users\Peter Juul Ornstrup\Documents\EspSparsnasGateway-master\EspSparsnasGateway\callback.ino: In function 'void callback(char, byte, unsigned int)':

callback:2: error: redefinition of 'void callback(char, byte, unsigned int)'

void callback(char topic, byte payload, unsigned int length) {

  ^

EspSparsnasGateway:566: error: 'void callback(char, byte, unsigned int)' previously defined here

void callback(char topic, byte payload, unsigned int length) {

  ^

callback:38: error: 'EEPROM' was not declared in this scope

     EEPROM.write(addr, 1); // Indicate stored settings by writing 1 to Eeprom address 0

     ^

callback:52: error: 'mqtt_debug_topic' was not declared in this scope

     client.publish(mqtt_debug_topic, msg);

                    ^

callback:66: error: 'EEPROM' was not declared in this scope

   EEPROM.write(addr, 1);    // Indicate stored settings by writing 1 to Eeprom address 1

   ^

callback:82: error: 'mqtt_debug_topic' was not declared in this scope

   client.publish(mqtt_debug_topic, msg);

                  ^

callback:90: error: 'EEPROM' was not declared in this scope

     EEPROM.write(i, 0);

     ^

callback:92: error: 'EEPROM' was not declared in this scope

   EEPROM.commit();

   ^

callback:96: error: 'mqtt_debug_topic' was not declared in this scope

   client.publish(mqtt_debug_topic, msg);

                  ^

callback:105: error: 'mqtt_debug_topic' was not declared in this scope

   client.publish(mqtt_debug_topic, msg);

                  ^

exit status 1 call of overloaded 'readRSSI()' is ambiguous

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

bphermansson commented 6 years ago

You dont need no libraries. Do you have the code in tabs?

skarmbild fran 2018-03-31 06-56-00

pornstrup commented 6 years ago

Yes got the codes in tabs. Will try and start from scratch and see if that helps. Will get back to you. Thanks.