mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 03:39:49 +03:00
CAN NOIP config load fix
This commit is contained in:
@@ -140,10 +140,9 @@ bool canDriver::sendRemoteID(macAddress mac)
|
|||||||
id.payloadType=payloadType::lookupMAC;
|
id.payloadType=payloadType::lookupMAC;
|
||||||
|
|
||||||
id.subjId=200; //CRC16 of remote config
|
id.subjId=200; //CRC16 of remote config
|
||||||
//packet.data[0]=1;
|
|
||||||
|
|
||||||
debugSerial<<("CAN: Send remote ID")<<endl;
|
debugSerial<<("CAN: Send remote ID")<<endl;
|
||||||
res = write (id.id);//,&packet,8);
|
res = write (id.id,(datagram_t*)mac,6);
|
||||||
if (res) state=canState::Idle;
|
if (res) state=canState::Idle;
|
||||||
else state=canState::Error;
|
else state=canState::Error;
|
||||||
// responseTimer=millisNZ(); ????????
|
// responseTimer=millisNZ(); ????????
|
||||||
@@ -344,7 +343,7 @@ debugSerial.print(len);
|
|||||||
debugSerial.print(" bytes id:");
|
debugSerial.print(" bytes id:");
|
||||||
debugSerial.println(id.id,HEX);
|
debugSerial.println(id.id,HEX);
|
||||||
|
|
||||||
if (id.deviceId && (id.deviceId != controllerId) && !id.status) return false;
|
//if (id.deviceId && (id.deviceId != controllerId) && !id.status) return false;
|
||||||
|
|
||||||
debugSerial<<"CAN: " ;
|
debugSerial<<"CAN: " ;
|
||||||
if (id.status) debugSerial.print("Resp "); else debugSerial.print("Req ");
|
if (id.status) debugSerial.print("Resp "); else debugSerial.print("Req ");
|
||||||
@@ -354,14 +353,31 @@ switch ((id.payloadType)){
|
|||||||
debugSerial.print("itemCmd");
|
debugSerial.print("itemCmd");
|
||||||
debugSerial<<" itemId:"<< id.itemId;
|
debugSerial<<" itemId:"<< id.itemId;
|
||||||
if (id.subItemId!=NO_SUBITEM) debugSerial << " subItem:"<<id.subItemId;
|
if (id.subItemId!=NO_SUBITEM) debugSerial << " subItem:"<<id.subItemId;
|
||||||
//debugSerial << ") ";
|
|
||||||
|
if (id.deviceId && (id.deviceId != controllerId) && !id.status) //ignore requests with NON ZERO devId where another CANID
|
||||||
|
{
|
||||||
|
debugSerial.println(")");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case payloadType::lookupMAC:
|
case payloadType::lookupMAC:
|
||||||
debugSerial.print("lookupMAC");
|
debugSerial.print("lookupMAC");
|
||||||
|
if (id.status && (memcmp(packet->mac, sysConf.mac,6))) //Ignore responses for another controller
|
||||||
|
{
|
||||||
|
debugSerial.println(")");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case payloadType::configFrame:
|
case payloadType::configFrame:
|
||||||
debugSerial.print("configFrame #");
|
debugSerial.print("configFrame #");
|
||||||
debugSerial<< id.subjId;
|
debugSerial<< id.subjId;
|
||||||
|
if (id.status && (id.deviceId != controllerId)) //Ignore responses on config request not for me
|
||||||
|
{
|
||||||
|
debugSerial.println(")");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case payloadType::OTAFrame:
|
case payloadType::OTAFrame:
|
||||||
debugSerial.print("OTAFrame #");
|
debugSerial.print("OTAFrame #");
|
||||||
@@ -377,9 +393,20 @@ switch ((id.payloadType)){
|
|||||||
break;
|
break;
|
||||||
case payloadType::sysCmd:
|
case payloadType::sysCmd:
|
||||||
debugSerial.print("sysCmd");
|
debugSerial.print("sysCmd");
|
||||||
|
if (id.deviceId != controllerId) //Ignore commands not for me
|
||||||
|
{
|
||||||
|
debugSerial.println(")");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case payloadType::rawPinCtrl:
|
case payloadType::rawPinCtrl:
|
||||||
debugSerial.print("rawPinCtrl");
|
debugSerial.print("rawPinCtrl");
|
||||||
|
if (id.deviceId != controllerId) //Ignore commands not for me
|
||||||
|
{
|
||||||
|
debugSerial.println(")");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
debugSerial<< ") ";
|
debugSerial<< ") ";
|
||||||
|
|
||||||
|
|||||||
@@ -689,7 +689,7 @@ if (!payload) return 0;
|
|||||||
int fr = freeRam();
|
int fr = freeRam();
|
||||||
if (fr < minimalMemory)
|
if (fr < minimalMemory)
|
||||||
{
|
{
|
||||||
errorSerial<<F("CTRL/txt: OutOfMemory: ")<<fr<<endl;
|
errorSerial<<F("MQTT: CTRL/txt: OutOfMemory: ")<<fr<<endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ void mqttCallback(char *topic, byte *payload, unsigned int length)
|
|||||||
|
|
||||||
int fr = freeRam();
|
int fr = freeRam();
|
||||||
|
|
||||||
debugSerial<<fr<<F(":[")<<topic<<F("] ");
|
debugSerial<<F("MQTT:")<<fr<<F(":[")<<topic<<F("] ");
|
||||||
|
|
||||||
if (fr < 250+MQTT_TOPIC_LENGTH) {
|
if (fr < 250+MQTT_TOPIC_LENGTH) {
|
||||||
errorSerial<<F("OutOfMemory!")<<endl;
|
errorSerial<<F("OutOfMemory!")<<endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user