Closed MonoLogueChi closed 3 months ago
Either MSGPACKETIZER_ENABLE_ETHER
or MSGPACKETIZER_ENABLE_WIFI
will be defined for all boards. So, MSGPACKETIZER_ENABLE_NETWORK
will be defined for all boards.
The Arduino framework usually has Udp.h
and Client.h
, so almost all boards are available for this library. It seems that arduino_core_ch32 also has them.
https://github.com/openwch/arduino_core_ch32/tree/main/cores/arduino
But I am using CH32-1.0.3, and even the latest CH32-1.0.4 does not include UDP.h,I will use the main branch for testing later, but I hope to have control over it
Please give me the error details
error:
In file included from D:\Users\mc\Documents\Arduino\Projects\msgpack-demo\msgpack-demo.ino:3:
d:\Users\mc\Documents\Arduino\libraries\MsgPacketizer/MsgPacketizer.h:22:10: fatal error: Udp.h: No such file or directory
#include <Udp.h>
^~~~~~~
compilation terminated.
exit status 1
Compilation error: exit status 1
ino:
#include <Arduino.h>
#include <MsgPack.h>
#include <MsgPacketizer.h>
// #include <U8g2lib.h>
// U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R2, /* reset=*/U8X8_PIN_NONE, /* clock=*/9, /* data=*/8);
// U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R2, /* reset=*/U8X8_PIN_NONE, /* clock=*/PB10, /* data=*/PB11);
struct MessgaeData {
// MsgPack::arr_t<uint8_t> Id;
uint8_t Type;
uint8_t Code;
MsgPack::arr_t<uint8_t> Data;
MSGPACK_DEFINE(Type, Code, Data);
};
MessgaeData data = {
.Type = 0,
.Code = 0,
.Data = { 1, 2, 3, 4 }
};
byte send_index = 0x01;
byte recv_index = 0x01;
void setup() {
Serial.begin(115200);
// u8g2.setBusClock(800000);
// u8g2.begin();
// MsgPacketizer::publish(Serial, send_index, data)
// ->setFrameRate(1.f);
MsgPacketizer::subscribe(Serial, recv_index,
[&](const MessgaeData& md) {
// u8g2.drawXBMP(0, 0, 88, 64, md.Data.data());
// u8g2.updateDisplay();
});
}
void loop() {
MsgPacketizer::update();
}
When I comment out
// #define PACKETIZER_ENABLE_NETWORK
// #include <Udp.h>
// #include <Client.h>
// #define MSGPACKETIZER_ENABLE_NETWORK
// #include <Udp.h>
// #include <Client.h>
in Packetizer.h
and MsgPacketizer.h
, it compiles fine
How about examples?
How about examples?
this https://github.com/hideakitai/MsgPacketizer/issues/24#issuecomment-2244923510
And there is a simpler
#include <Arduino.h>
#include <MsgPacketizer.h>
void setup() {
}
void loop() {
}
Simply, Ethernet
library and related components are not included (not a compile target) in the arduino-core-ch32. It's a problem of ch32 core
Now you can use the following code with Packtizer v0.8.3 and MsgPacketizer v0.5.3
#define MSGPACKETIZER_DISABLE_NETWORK
#include <MsgPacketizer.h>
Thanks
If I read it correctly,
MSGPACKETIZER_ENABLE_ETHER
is defined whenMSGPACKETIZER_ENABLE_WIFI
is not defined.Does this mean that
MSGPACKETIZER_ENABLE_NETWORK
must be defined? But#include <Udp.h>
will report an error on some development boards, such as ch32v307