fix overflow issue when converting 10bit to 16bit range
This commit is contained in:
@@ -123,7 +123,7 @@ namespace Range {
|
||||
static inline To scale_from_bits(From value)
|
||||
{
|
||||
return scale<To>(
|
||||
value,
|
||||
Range::clamp(value, BITS_MIN<From, bits>(), BITS_MAX<From, bits>()),
|
||||
BITS_MIN<From, bits>(),
|
||||
BITS_MAX<From, bits>(),
|
||||
Range::MIN<To>,
|
||||
@@ -135,7 +135,7 @@ namespace Range {
|
||||
static inline To scale_to_bits(From value)
|
||||
{
|
||||
return scale<To>(
|
||||
value,
|
||||
Range::clamp(value, BITS_MIN<From, bits>(), BITS_MAX<From, bits>()),
|
||||
Range::MIN<From>,
|
||||
Range::MAX<From>,
|
||||
BITS_MIN<To, bits>(),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "board_config.h"
|
||||
#if defined(CONFIG_EN_BLUETOOTH)
|
||||
|
||||
#include <atomic>
|
||||
#include <pico/cyw43_arch.h>
|
||||
|
||||
#include "Board/board_api_private/board_api_private.h"
|
||||
@@ -11,16 +12,26 @@ static_assert(CYW43_WL_GPIO_LED_PIN != LED_INDICATOR_PIN, "CYW43_WL_GPIO_LED_PIN
|
||||
|
||||
namespace board_api_bt {
|
||||
|
||||
std::atomic<bool> inited{false};
|
||||
|
||||
void init()
|
||||
{
|
||||
if (cyw43_arch_init() != 0)
|
||||
{
|
||||
panic("CYW43 init failed");
|
||||
}
|
||||
else
|
||||
{
|
||||
inited.store(true);
|
||||
}
|
||||
}
|
||||
|
||||
void set_led(bool state)
|
||||
{
|
||||
if (!inited.load())
|
||||
{
|
||||
return;
|
||||
}
|
||||
cyw43_arch_gpio_put(CYW43_WL_GPIO_LED_PIN, state ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Range {
|
||||
static inline To scale_from_bits(From value)
|
||||
{
|
||||
return scale<To>(
|
||||
value,
|
||||
Range::clamp(value, BITS_MIN<From, bits>(), BITS_MAX<From, bits>()),
|
||||
BITS_MIN<From, bits>(),
|
||||
BITS_MAX<From, bits>(),
|
||||
Range::MIN<To>,
|
||||
@@ -135,7 +135,7 @@ namespace Range {
|
||||
static inline To scale_to_bits(From value)
|
||||
{
|
||||
return scale<To>(
|
||||
value,
|
||||
Range::clamp(value, BITS_MIN<From, bits>(), BITS_MAX<From, bits>()),
|
||||
Range::MIN<From>,
|
||||
Range::MAX<From>,
|
||||
BITS_MIN<To, bits>(),
|
||||
|
||||
@@ -76,7 +76,7 @@ void run_program()
|
||||
multicore_reset_core1();
|
||||
multicore_launch_core1(core1_task);
|
||||
|
||||
board_api::esp32::reset();
|
||||
// board_api::esp32::reset();
|
||||
|
||||
DeviceDriver* device_driver = device_manager.get_driver();
|
||||
|
||||
|
||||
2
WebApp
2
WebApp
Submodule WebApp updated: 0dd56b96a8...d46ea2f7b9
Reference in New Issue
Block a user