Publish model when networkid was received

This commit is contained in:
Pascal Serrarens 2024-05-29 12:18:11 +02:00
parent 95988c924a
commit 186ccd92e5

View File

@ -28,8 +28,9 @@ void NetworkSync::ReceiveMessage(Roboid *roboid, unsigned char bytecount) {
void NetworkSync::ReceiveNetworkId() { void NetworkSync::ReceiveNetworkId() {
this->networkId = buffer[1]; this->networkId = buffer[1];
#ifdef RC_DEBUG #ifdef RC_DEBUG
printf("Received network Id %d\n", this->networkId); printf("_Received network Id %d\n", this->networkId);
#endif #endif
PublishModel(roboid);
} }
void NetworkSync::NewObject(InterestingThing *thing) { void NetworkSync::NewObject(InterestingThing *thing) {
@ -50,6 +51,9 @@ void NetworkSync::NewObject(InterestingThing *thing) {
} }
void NetworkSync::PublishModel(Roboid *roboid) { void NetworkSync::PublishModel(Roboid *roboid) {
if (roboid->modelUrl == nullptr)
return;
int len = strlen(roboid->modelUrl); int len = strlen(roboid->modelUrl);
if (len > 255) if (len > 255)
return; return;