Fix compilation warning

STM32 uses TP
This commit is contained in:
etrinh 2020-04-02 22:10:50 +02:00
parent ced8aa0a31
commit 0f99a4c969
4 changed files with 10 additions and 8 deletions

View File

@ -1723,8 +1723,9 @@ double float16FromPayload(const uint8_t* payload, int index)
}
float float32FromPayload(const uint8_t* payload, int index)
{
uint32_t area = unsigned32FromPayload(payload, index);
return *((float*)&area);
union { float f; uint32_t i; } area;
area.i = unsigned32FromPayload(payload, index);
return area.f;
}
int64_t signed64FromPayload(const uint8_t* payload, int index)
{
@ -1815,8 +1816,9 @@ void float16ToPayload(uint8_t* payload, size_t payload_length, int index, double
}
void float32ToPayload(uint8_t* payload, size_t payload_length, int index, double value, uint32_t mask)
{
float num = value;
unsigned32ToPayload(payload, payload_length, index, *((uint32_t*)&num), mask);
union { float f; uint32_t i; } num;
num.f = value;
unsigned32ToPayload(payload, payload_length, index, num.i, mask);
}
void signed64ToPayload(uint8_t* payload, size_t payload_length, int index, int64_t value, uint64_t mask)
{

View File

@ -526,7 +526,7 @@ struct tm KNXValue::timeValue() const
return *timePtr;
}
}
struct tm tmp;
struct tm tmp = {0};
return tmp;
}

View File

@ -23,7 +23,7 @@
// predefined global instance for IP only
KnxFacade<Esp32Platform, Bau57B0> knx;
#elif ARDUINO_ARCH_STM32
KnxFacade<Stm32Platform, Bau57B0> knx;
KnxFacade<Stm32Platform, Bau07B0> knx;
// no predefined global instance
#define ICACHE_RAM_ATTR
#elif __linux__

View File

@ -20,7 +20,7 @@
#include "knx/bau57B0.h"
#elif ARDUINO_ARCH_STM32
#include "stm32_platform.h"
#include "knx/bau57B0.h"
#include "knx/bau07B0.h"
#else
#define LED_BUILTIN 0
#include "linux_platform.h"
@ -338,7 +338,7 @@ template <class P, class B> class KnxFacade : private SaveRestore
extern KnxFacade<Esp32Platform, Bau57B0> knx;
#elif ARDUINO_ARCH_STM32
// predefined global instance for TP only
extern KnxFacade<Stm32Platform, Bau57B0> knx;
extern KnxFacade<Stm32Platform, Bau07B0> knx;
#elif __linux__
// no predefined global instance
#endif