compile for esp32 fails
trackme518 opened this issue · 4 comments
Hi,
when using esp32 definitions version 2.0.14 (https://github.com/espressif/arduino-esp32) I can compile for esp32 s2 mini but not for esp32 c3 super mini. The code is unchanged for these two. Errors below. Also when I tried to upgrade the board definitions for esp32 to to 3.0.0 alpha3 it will fail for esp32 s2 mini as well.
In file included from c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCBundle.h:29,
from C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\OscManager.hpp:4,
from C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\moduleWifiSerial.ino:14:
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCMessage.h: In instantiation of 'OSCMessage& OSCMessage::add(T) [with T = int]':
C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\OscManager.hpp:116:39: required from here
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCMessage.h:136:17: error: call of overloaded 'OSCData(int&)' is ambiguous
OSCData * d = new OSCData(datum);
^~~~~~~~~~~~~~~~~~
In file included from c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCMessage.h:29,
from c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCBundle.h:29,
from C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\OscManager.hpp:4,
from C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\moduleWifiSerial.ino:14:
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:106:5: note: candidate: 'OSCData::OSCData(boolean)'
OSCData (boolean);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:102:2: note: candidate: 'OSCData::OSCData(double)'
OSCData (double);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:101:2: note: candidate: 'OSCData::OSCData(float)'
OSCData (float);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:100:5: note: candidate: 'OSCData::OSCData(unsigned int)'
OSCData (unsigned int);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:96:2: note: candidate: 'OSCData::OSCData(int32_t)'
OSCData (int32_t);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:67:5: note: candidate: 'OSCData::OSCData(char)'
OSCData(char t);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:57:7: note: candidate: 'constexpr OSCData::OSCData(const OSCData&)'
class OSCData
^~~~~~~
In file included from c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCBundle.h:29,
from C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\OscManager.hpp:4,
from C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\moduleWifiSerial.ino:14:
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCMessage.h: In instantiation of 'OSCMessage& OSCMessage::add(T) [with T = short int]':
C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\moduleWifiSerial.ino:65:37: required from here
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCMessage.h:136:17: error: call of overloaded 'OSCData(short int&)' is ambiguous
OSCData * d = new OSCData(datum);
^~~~~~~~~~~~~~~~~~
In file included from c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCMessage.h:29,
from c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCBundle.h:29,
from C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\OscManager.hpp:4,
from C:\Users\neuromancer\Documents\GitHub\datainmotion\ArduinoIDE\moduleWifiSerial\moduleWifiSerial.ino:14:
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:106:5: note: candidate: 'OSCData::OSCData(boolean)'
OSCData (boolean);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:102:2: note: candidate: 'OSCData::OSCData(double)'
OSCData (double);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:101:2: note: candidate: 'OSCData::OSCData(float)'
OSCData (float);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:100:5: note: candidate: 'OSCData::OSCData(unsigned int)'
OSCData (unsigned int);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:96:2: note: candidate: 'OSCData::OSCData(int32_t)'
OSCData (int32_t);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:67:5: note: candidate: 'OSCData::OSCData(char)'
OSCData(char t);
^~~~~~~
c:\Users\neuromancer\Documents\Arduino\libraries\OSC-3.5.8/OSCData.h:57:7: note: candidate: 'constexpr OSCData::OSCData(const OSCData&)'
class OSCData
^~~~~~~
Usage in my code - parsing:
void receiveOSC() {
OSCMessage msgIN;
int size;
//read OSC over WiFi -----------------------
size = Udp.parsePacket();
if (size > 0) {
OSCMessage inboundMsg;
while (size--) {
inboundMsg.fill(Udp.read());
}
if (!inboundMsg.hasError()) {
const IPAddress hostip = Udp.remoteIP(); // must be constant otherwise I can not get a pointer to it
parseOSC(inboundMsg, hostip);
} else {
Serial.println("UDP OSC msg has errors");
}
}
and start of the parseOSC function:
void parseOSC(OSCMessage &msg, const IPAddress &remoteip) {
boolean hasip = false;
if (msg.fullMatch("/connect")) {
////Serial.println("connect request");
if (msg.size() > 0) { // it has a value
char ipServerAddress[18];
msg.getString(0, ipServerAddress, 18);
IPAddress currip;
if (currip.fromString(ipServerAddress)) { // str = char * or String
// it is a valid IP address
Serial.println("connect request: custom IP");
wifiman.unicastIP.fromString(ipServerAddress);
hasip = true;
} else {
Serial.println("invalid IP");
}
}
Hi,
the problem was that library somehow does not account for int / int16 when using esp32 c3? I have solved it by casting all integers to 32bit like message.add( (int32_t) int-variable );
Maybe another type can be added to constructor with int16_t type?
Your solution is the correct one. If we provided a an add that worked for int16_t the design would call for it to use a special osc type for 16 bit integers which is not standard. People have done it though.
I am toying with the idea of adding a method:
addAsOSCint()
This would avoid the cast and the need to bake in the OSC integer format type.
I addressed this and all sorts of issues due to compiler variations in the latest Main.
Recommendation is to use intOSC_t as the cast. I have tested on a lot of platforms. Not quite all of them yet though.