Minor cleanups

This commit is contained in:
Oleg Kalachev 2024-01-17 15:20:38 +03:00
parent 482bb8ed71
commit 8e629e3eea
3 changed files with 6 additions and 5 deletions

View File

@ -54,9 +54,9 @@ void sendMavlink() {
} }
} }
inline void sendMessage(const void *msg) { void sendMessage(const void *msg) {
uint8_t buf[MAVLINK_MAX_PACKET_LEN]; uint8_t buf[MAVLINK_MAX_PACKET_LEN];
uint16_t len = mavlink_msg_to_send_buffer(buf, (mavlink_message_t *)msg); int len = mavlink_msg_to_send_buffer(buf, (mavlink_message_t *)msg);
sendWiFi(buf, len); sendWiFi(buf, len);
} }

View File

@ -3,7 +3,7 @@
// Utility functions // Utility functions
#include "math.h" #include <math.h>
#include <soc/soc.h> #include <soc/soc.h>
#include <soc/rtc_cntl_reg.h> #include <soc/rtc_cntl_reg.h>
@ -23,7 +23,7 @@ float randomFloat(float min, float max) {
return min + (max - min) * (float)rand() / RAND_MAX; return min + (max - min) * (float)rand() / RAND_MAX;
} }
// wrap angle to [-PI, PI) // Wrap angle to [-PI, PI)
float wrapAngle(float angle) { float wrapAngle(float angle) {
angle = fmodf(angle, 2 * PI); angle = fmodf(angle, 2 * PI);
if (angle > PI) { if (angle > PI) {

View File

@ -22,7 +22,8 @@ void setupWiFi() {
IPAddress myIP = WiFi.softAPIP(); IPAddress myIP = WiFi.softAPIP();
} }
inline void sendWiFi(const uint8_t *buf, size_t len) { void sendWiFi(const uint8_t *buf, int len) {
// if (!udp.beginPacket(WIFI_UDP_IP, WIFI_UDP_PORT)) return;
udp.beginPacket(WIFI_UDP_IP, WIFI_UDP_PORT); udp.beginPacket(WIFI_UDP_IP, WIFI_UDP_PORT);
udp.write(buf, len); udp.write(buf, len);
udp.endPacket(); udp.endPacket();