@droftarts , @rechrtb
I think I found the problem. in "Network.cpp" there is the following:
// This is called at the end of config.g processing. It must only be called once.
// Start the network if it was enabled
void Network::Activate() noexcept
{
#if HAS_NETWORKING
// Allocate network buffers
NetworkBuffer::AllocateBuffers(NetworkBufferCount);
// Activate the interfaces
for (NetworkInterface *iface : interfaces)
{
if (iface != nullptr)
{
iface->Activate();
}
}
// Create the network responders
# if SUPPORT_TELNET
for (size_t i = 0; i < NumTelnetResponders; ++i)
{
responders = new TelnetResponder(responders);
}
# endif
# if SUPPORT_FTP
for (size_t i = 0; i < NumFtpResponders; ++i)
{
responders = new FtpResponder(responders);
}
# endif
# if SUPPORT_HTTP
for (size_t i = 0; i < NumHttpResponders; ++i)
{
responders = new HttpResponder(responders);
}
# endif
#if SUPPORT_MULTICAST_DISCOVERY
MulticastResponder::Init();
#endif
#if SUPPORT_MQTT
responders = clients = MqttClient::Init(responders, clients);
#endif
// Finally, create the network task
networkTask.Create(NetworkLoop, "NETWORK", nullptr, TaskPriority::SpinPriority);
#endif
}
In MqttClient.cpp is this routine:
MqttClient *MqttClient::Init(NetworkResponder *n, NetworkClient *c) noexcept
{
instance = new MqttClient(n, c);
return instance;
}
which initializes "instance". "Instance" is used in the firmware that is called when M586.4 is seen. So, any use of M586.4 before the completion of the first call to config.g after reset should be unsuccessful. The error message is misleading; the problem is not that transactions are occurring but that the data structure hasn't been allocated yet.
I can apply your patch and test it out in my custom firmware build.
Gene