-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
705e80b
commit 3b813c0
Showing
13 changed files
with
140 additions
and
134 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <M5EPD.h> | ||
|
||
void clear_canvas(M5EPD_Canvas &canvas) { | ||
canvas.clear(); | ||
canvas.setCursor(0, 0); | ||
} | ||
|
||
void init_epd(M5EPD_Canvas &canvas_title, M5EPD_Canvas &canvas_status, M5EPD_Canvas &canvas_message) { | ||
canvas_title.createCanvas(540, 100); | ||
canvas_status.createCanvas(540, 60); | ||
canvas_message.createCanvas(540, 800); | ||
canvas_title.setTextSize(3); | ||
canvas_status.setTextSize(2); | ||
canvas_message.setTextSize(2); | ||
clear_canvas(canvas_title); | ||
clear_canvas(canvas_status); | ||
clear_canvas(canvas_message); | ||
} | ||
|
||
void update_epd(M5EPD_Canvas &canvas_title, M5EPD_Canvas &canvas_status, M5EPD_Canvas &canvas_message) { | ||
canvas_title.pushCanvas(0, 0, UPDATE_MODE_DU4); | ||
canvas_status.pushCanvas(0, 100, UPDATE_MODE_DU4); | ||
canvas_message.pushCanvas(0, 160, UPDATE_MODE_DU4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <smart_device_protocol/Packet.h> | ||
|
||
#include <variant> | ||
#include <vector> | ||
|
||
#include "sdp/packet_creator.h" | ||
#include "sdp/packet_parser.h" | ||
|
||
class Message { | ||
public: | ||
inline static std::string packet_description_write = "Message Board to write"; | ||
inline static std::string serialization_format_write = "siS"; | ||
inline static std::string packet_description_message = "Message Board message"; | ||
|
||
char message[64]; | ||
char source_name[64]; | ||
unsigned long deadline; | ||
|
||
Message(char *source_name, char *message, int32_t timeout_duration) { | ||
strncpy(this->source_name, source_name, 16); | ||
strncpy(this->message, message, 64); | ||
this->deadline = (int32_t)millis() + timeout_duration; | ||
} | ||
|
||
void to_v2_packet(uint8_t *data) { | ||
std::vector<std::variant<int32_t, float, std::string, bool>> data_vector; | ||
data_vector.push_back(std::variant<int32_t, float, std::string, bool>(std::string(source_name))); | ||
data_vector.push_back(std::variant<int32_t, float, std::string, bool>((int32_t)(this->deadline - millis()))); | ||
data_vector.push_back(std::variant<int32_t, float, std::string, bool>(std::string(message))); | ||
generate_data_frame(data, packet_description_message.c_str(), data_vector); | ||
} | ||
|
||
static SDPInterfaceDescription get_interface_description() { | ||
return std::make_tuple(packet_description_message, serialization_format_write); | ||
} | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.