This commit is contained in:
Pascal Serrarens 2025-01-12 09:07:14 +01:00
parent 54ab547d5d
commit 64cdf9ccfb
4 changed files with 11 additions and 1 deletions

View File

@ -123,7 +123,7 @@ const SphericalOf<T> SphericalOf<T>::down =
template <typename T>
SphericalOf<T> SphericalOf<T>::WithDistance(float distance) {
SphericalOf<T> v = SphericalOf<T>(distance, this->direction);
return SphericalOf<T>();
return v;
}
template <typename T> SphericalOf<T> SphericalOf<T>::operator-() const {

View File

@ -7,6 +7,8 @@ namespace Control {
// TemperatureSensor::TemperatureSensor() : Thing(Type::TemperatureSensor) {}
TemperatureSensor::TemperatureSensor() : Thing(Type::TemperatureSensor) {}
TemperatureSensor::TemperatureSensor(unsigned char networkId,
unsigned char thingId)
: Thing(nullptr, networkId, thingId, Type::TemperatureSensor) {}

View File

@ -7,6 +7,7 @@ namespace Control {
class TemperatureSensor : public Thing {
public:
TemperatureSensor();
TemperatureSensor(unsigned char networkId, unsigned char thingId);
virtual void SetTemperature(float temp);

View File

@ -188,6 +188,13 @@ float float16::f16tof32(uint16_t _value) const {
}
uint16_t float16::f32tof16(float f) const {
// untested code, but will avoid strict aliasing warning
// union {
// float f;
// uint32_t t;
// } u;
// u.f = f;
// uint32_t t = u.t;
uint32_t t = *(uint32_t *)&f;
// man bits = 10; but we keep 11 for rounding
uint16_t man = (t & 0x007FFFFF) >> 12;