diff --git a/libraries/ruuvi_sensor_formats/sensortag.c b/libraries/ruuvi_sensor_formats/sensortag.c index 11a86b10..0fbefb12 100644 --- a/libraries/ruuvi_sensor_formats/sensortag.c +++ b/libraries/ruuvi_sensor_formats/sensortag.c @@ -87,8 +87,12 @@ void encodeToRawFormat3(uint8_t* data_buffer, const ruuvi_sensor_t* const data) if(data->humidity == HUMIDITY_INVALID) { humidity = 0; } data_buffer[1] = humidity / 512; int32_t temperature = data->temperature; + // RAWv1 uses 1-complement negative numbers + if(temperature < 0) { temperature = 0 - temperature; } if(data->temperature == TEMPERATURE_INVALID) { temperature = 0; } + bool negative = ((data->temperature < 0) && data->temperature != TEMPERATURE_INVALID); data_buffer[2] = temperature / 100; + data_buffer[2] |= (negative<<7 & 0x80); data_buffer[3] = temperature % 100; uint32_t pressure = data->pressure; if(data->pressure == PRESSURE_INVALID) { pressure = 50000<<8; } diff --git a/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h b/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h index a569d841..97fef3cd 100644 --- a/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h +++ b/ruuvi_examples/ruuvi_firmware/bluetooth_application_config.h @@ -5,7 +5,7 @@ #define APP_DEVICE_NAME APPLICATION_DEVICE_NAME /**< TODO: Refactoring **/ #define APP_DEVICE_NAME_LENGTH APPLICATION_DEVICE_NAME_LENGTH #define APP_TX_POWER 4 /**< dBm **/ -#define INIT_FWREV "2.5.7" /**< Github tag. Do not include specifiers such as "alpha" so you can accept ready binaries as they are **/ +#define INIT_FWREV "2.5.9" /**< Github tag. Do not include specifiers such as "alpha" so you can accept ready binaries as they are **/ #define INIT_SWREV INIT_FWREV /**< FW and SW are same thing in this context **/ // milliseconds until main loop timer function is called. Other timers can bring diff --git a/ruuvi_examples/ruuvi_firmware/ruuvitag_b/s132/armgcc/package.sh b/ruuvi_examples/ruuvi_firmware/ruuvitag_b/s132/armgcc/package.sh new file mode 100755 index 00000000..85c8a90d --- /dev/null +++ b/ruuvi_examples/ruuvi_firmware/ruuvitag_b/s132/armgcc/package.sh @@ -0,0 +1,8 @@ +#!/bin/bash +nrfutil settings generate --family NRF52 --application _build/ruuvi_firmware.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex +mergehex -m ~/git/s132_nrf52_3.1.0_softdevice.hex ~/git/ruuvitag_b_bootloader_1.0.0.hex settings.hex -o sbc.hex +mergehex -m sbc.hex _build/ruuvi_firmware.hex -o packet.hex + +nrfutil pkg generate --debug-mode --application _build/ruuvi_firmware.hex --hw-version 3 --sd-req 0x91 --key-file ~/git/ruuvitag_fw/keys/ruuvi_open_private.pem ruuvi_firmware_dfu.zip +mv packet.hex ruuvi_firmware_full.hex +