Author Topic: MightyHat Sketch Compile Issues [SOLVED]  (Read 11456 times)

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
MightyHat Sketch Compile Issues [SOLVED]
« on: May 04, 2020, 08:47:37 PM »
Hey Everyone -

I have been running several mightyhats and needed to update one of my sketches and I am now getting an error trying to compile. I did the normal 'google search' route but did not come up with anything. I was hoping someone here has seen this before.

Thanks

Code: [Select]
Arduino: 1.8.12 (Mac OS X), Board: "MightyHat"

libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `readSerialLine(char*, char, unsigned char, unsigned int)'
libraries/RFM69/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `BYTEfromHEX(char, char)'
libraries/RFM69/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `validateHEXData(void*, unsigned char)'
libraries/RFM69/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `prepareSendBuffer(char*, unsigned char*, unsigned char, unsigned int)'
libraries/RFM69/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `PrintHex83(unsigned char*, unsigned char)'
libraries/RFM69/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board MightyHat.
« Last Edit: May 05, 2020, 04:45:57 PM by G550_Pilot »

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: MightyHat Sketch Compile Issues
« Reply #1 on: May 05, 2020, 03:37:50 PM »
OK, so I have tried the following to resolve this issue:

1) Moved to another OSX system
2) Reinstalled Arduino and reinstalled the LowPowerLabs libraries (although could not find the wireless libraries on github, just a windows exe so I reused the old ones that I had)
3) Installed Ubuntu 20.04LTS, installed Arduino, updated libraries and board defs. Still same error:

Code: [Select]
Arduino: 1.8.12 (Linux), Board: "MightyHat"

libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `readSerialLine(char*, char, unsigned char, unsigned int)'
libraries/RFM69_LowPowerLab/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `BYTEfromHEX(char, char)'
libraries/RFM69_LowPowerLab/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `validateHEXData(void*, unsigned char)'
libraries/RFM69_LowPowerLab/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `prepareSendBuffer(char*, unsigned char*, unsigned char, unsigned int)'
libraries/RFM69_LowPowerLab/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/WirelessHEX69/WirelessHEX69.cpp.o (symbol from plugin): In function `readSerialLine(char*, char, unsigned char, unsigned int)':
(.text+0x0): multiple definition of `PrintHex83(unsigned char*, unsigned char)'
libraries/RFM69_LowPowerLab/RFM69_OTA.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board MightyHat.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: MightyHat Sketch Compile Issues
« Reply #2 on: May 05, 2020, 04:17:12 PM »
1.8.12 compiles fine on Windows.
The errors you get seem to indicate it doesnt like that you also have the old WirelessHEX69 library side by side with the new RFM69_OTA. Try removing wirelesshex69 and see if you make progress.

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: MightyHat Sketch Compile Issues
« Reply #3 on: May 05, 2020, 04:41:03 PM »
Actually I was just coming back here to post that I had success. But it took going back to your old Github branch for the wireless and seeing the note about using RFM69_OTA.h instead of WirelessHEX69.h which I had not done since it has been several years since having to update my MightyHats.

so changing this:
#include <WirelessHEX69.h>

to this:
#include <RFM69_OTA.h>


immediately solved the problem!


As a side note, as part of my troubleshooting, I downloaded your latest MightyHat.ino and I noticed it looks like it no longer looks for serial messages from the Pi. Is that correct, or am I just missing it somewhere? I use that to send data to the LCD screens so I was just wondering.

Thanks!


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: MightyHat Sketch Compile Issues [SOLVED]
« Reply #4 on: May 05, 2020, 04:57:19 PM »
Latest sketch is like the old one + a bunch of other functionality.
Yes it looks for serial data from Pi.

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: MightyHat Sketch Compile Issues [SOLVED]
« Reply #5 on: May 05, 2020, 09:27:27 PM »
OK, I was taking a look at it and didn't see where. In the old sketch, I did this:

if (inputstr.equals("START_OK")) { sprintf(lcdbuff, "PFC\nStart OK!"); refreshLCD(); saveToHistory(lcdbuff, rssi); }

in this section:
void handleSerialInput()

Where would I put it in the new sketch?

I see this in the new sketch:

void handleSerialData()

but not sure how to add:
if (inputstr.equals("START_OK")) { sprintf(lcdbuff, "PFC\nStart OK!"); refreshLCD(); saveToHistory(lcdbuff, rssi); }

to it. My attempts failed :-)
« Last Edit: May 05, 2020, 09:31:11 PM by G550_Pilot »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: MightyHat Sketch Compile Issues [SOLVED]
« Reply #6 on: May 06, 2020, 12:47:52 PM »
You want something like this:

Code: [Select]
if (strcmp(data, "START_OK")==0) {
        Pbuff="";
        Pbuff << "START_OK";
        saveToHistory(buff, 0);
        refreshLCD();
}

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: MightyHat Sketch Compile Issues [SOLVED]
« Reply #7 on: May 06, 2020, 04:10:04 PM »
Got it, and this would be in the:

void handleSerialData()

section?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: MightyHat Sketch Compile Issues [SOLVED]
« Reply #8 on: May 07, 2020, 07:33:53 AM »
I suppose so, where all other string comparisons are made.

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: MightyHat Sketch Compile Issues [SOLVED]
« Reply #9 on: May 07, 2020, 02:33:44 PM »
Thanks, I'll play around with trying to make it work!

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: MightyHat Sketch Compile Issues [SOLVED]
« Reply #10 on: May 07, 2020, 03:14:04 PM »
Hi Felix -

Sorry to be a bother. I tried a few different ways and I can't get it compile, can you give me an example in the current code below where exactly I would add in all of the serial stuff...? I would greatly appreciate it. C is not my best forte...

I have about 20 things I need to watch for to update the LCD.

Thanks :-)



Code: [Select]
if (strcmp(data, "START_OK")==0) {
        Pbuff="";
        Pbuff << "START_OK";
        saveToHistory(buff, 0);
        refreshLCD();
}


Code: [Select]
// here's the processing of single char/bytes as soon as they're coming from UART
void handleSerialData() {
  static char input_line[100]; //static = these get allocated ONCE!
  static byte input_pos = 0;
  if(Serial.available() > 0)
  {
    char inByte = Serial.read();
    switch (inByte)
    {
      case '\r':   //ignore carriage return
        break;

      case '\n':
        if (input_pos==0) break;       // ignore empty lines
        input_line[input_pos] = 0;     // null terminate the string
        DEBUG("DEBUG:handleSerialData:");
        DEBUGln(input_line);
        processCommand(input_line);        // fill up queue
        input_pos = 0; // reset buffer for next time
        break;

      default:
        // keep adding if not full ... allow for terminating byte
        if (input_pos < MAX_BUFFER_LENGTH-1) {
          input_line[input_pos] = inByte;
          input_pos++;
        } else {
          // if theres no EOL coming before MAX_BUFF_CHARS is exceeded we'll just terminate and send it, last char is then lost
          input_line[input_pos] = 0;    // null terminate the string
          DEBUG("DEBUG:MAX_BUFF_CHARS is exceeded - attempting to add (default): ");
          DEBUGln(input_line);
          processCommand(input_line);  //add to queue
          input_pos = 0; //reset buffer for next line
        }
        break;
    }
  }
}


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: MightyHat Sketch Compile Issues [SOLVED]
« Reply #11 on: May 07, 2020, 04:26:38 PM »
Look for this piece of code:

Code: [Select]
  if (strcmp(data, "FREERAM")==0)
    Serial << F("FREERAM:") << freeRAM() << ':' << RAMSIZE << endl;
  if (strcmp(data, "REQUESTQUEUE")==0)
    printQueue(queue);
  if (strcmp(data, "SYSFREQ")==0)
    Serial << F("SYSFREQ:") << radio.getFrequency() << endl;
  if (strcmp(data, "UPTIME")==0)
    Serial << F("UPTIME:") << millis() << endl;
  if (strcmp(data, "BEEP")==0) Beep(5, false);
  if (strcmp(data, "BEEP2")==0) Beep(10, false);
  if (strcmp(data, "ENCRYPTKEY")==0)
#ifdef ENCRYPTKEY
    Serial << F("ENCRYPTKEY:") << ENCRYPTKEY << endl;
#else
    Serial << F("ENCRYPTKEY:NONE") << endl;
#endif

Add your code somewhere in there:

Code: [Select]
  if (strcmp(data, "FREERAM")==0)
    Serial << F("FREERAM:") << freeRAM() << ':' << RAMSIZE << endl;
  if (strcmp(data, "REQUESTQUEUE")==0)
    printQueue(queue);
  if (strcmp(data, "SYSFREQ")==0)
    Serial << F("SYSFREQ:") << radio.getFrequency() << endl;
  if (strcmp(data, "UPTIME")==0)
    Serial << F("UPTIME:") << millis() << endl;
  if (strcmp(data, "BEEP")==0) Beep(5, false);
  if (strcmp(data, "BEEP2")==0) Beep(10, false);
  if (strcmp(data, "ENCRYPTKEY")==0)
#ifdef ENCRYPTKEY
    Serial << F("ENCRYPTKEY:") << ENCRYPTKEY << endl;
#else
    Serial << F("ENCRYPTKEY:NONE") << endl;
#endif
  if (strcmp(data, "START_OK")==0) {
        Pbuff="";
        Pbuff << "START_OK";
        saveToHistory(buff, 0);
        refreshLCD();
  }

G550_Pilot

  • Full Member
  • ***
  • Posts: 151
  • Country: us
Re: MightyHat Sketch Compile Issues [SOLVED]
« Reply #12 on: May 07, 2020, 08:32:19 PM »
Thanks Felix!!!