adlerweb / asysbus

Arduino System Bus
GNU General Public License v3.0
27 stars 17 forks source link

unicast message received as broadcast message #12

Open M1rk0 opened 2 years ago

M1rk0 commented 2 years ago

Hello Florian, thanks for your work on this nice project. I am getting some issues with unicast messages, sending messages like this:

MY_NODE_ID = 0x3;
ASB_BRIDGE_NODE_ID = 0x1;
bool sendTemp() {
    float temperature;
    ds18b20Sensors.requestTemperatures();
    temperature = ds18b20Sensors.getTempCByIndex(0);
    int firstTempPart = temperature;
    temperature -= firstTempPart;
    int secondTempPart = temperature * 10;
    Serial.println(firstTempPart);
    Serial.println(secondTempPart);
    const unsigned int targetAdress = ASB_BRIDGE_NODE_ID;
    const char tempPort = 0x10;
    const byte tempData[3] = {ASB_CMD_S_TEMP, firstTempPart, secondTempPart};
    const byte tempState = asb0.asbSend(ASB_PKGTYPE_UNICAST, targetAdress, tempPort, sizeof(tempData), tempData);
    return (tempState == 0);
}

and receiving them like this:

Type: 0x0
Target: 0x1
Source: 0x3
Port: 0xFFFFFFFF
Length: 0x3
  0xA0 0x1A 0x3

I am wondering, why it is not Type: 0x2 and Port: 0x10. My goal is, to get different Temperatures from one Node and use different ports for that.

I would appreciate If you have a hint for me solving this. Thanks

adlerweb commented 2 years ago

Looks like CAN was unable to detect unicast due to a hardcoded but outdated check. Could you try with the latest commit?

M1rk0 commented 2 years ago

I just flashed both nodes with the new commit, but i am getting the same output.