[pvvx_mithermometer] fix displaying negative numbers (#12735)
This commit is contained in:
@@ -60,13 +60,13 @@ class PVVXDisplay : public ble_client::BLEClientNode, public PollingComponent {
|
|||||||
* Valid values are from -99.5 to 1999.5. Smaller values are displayed as Lo, higher as Hi.
|
* Valid values are from -99.5 to 1999.5. Smaller values are displayed as Lo, higher as Hi.
|
||||||
* It will printed as it fits in the screen.
|
* It will printed as it fits in the screen.
|
||||||
*/
|
*/
|
||||||
void print_bignum(float bignum) { this->bignum_ = bignum * 10; }
|
void print_bignum(float bignum) { this->bignum_ = static_cast<int16_t>(bignum * 10); }
|
||||||
/**
|
/**
|
||||||
* Print the small number
|
* Print the small number
|
||||||
*
|
*
|
||||||
* Valid values are from -9 to 99. Smaller values are displayed as Lo, higher as Hi.
|
* Valid values are from -9 to 99. Smaller values are displayed as Lo, higher as Hi.
|
||||||
*/
|
*/
|
||||||
void print_smallnum(float smallnum) { this->smallnum_ = smallnum; }
|
void print_smallnum(float smallnum) { this->smallnum_ = static_cast<int16_t>(smallnum); }
|
||||||
/**
|
/**
|
||||||
* Print a happy face
|
* Print a happy face
|
||||||
*
|
*
|
||||||
@@ -107,8 +107,8 @@ class PVVXDisplay : public ble_client::BLEClientNode, public PollingComponent {
|
|||||||
bool auto_clear_enabled_{true};
|
bool auto_clear_enabled_{true};
|
||||||
uint32_t disconnect_delay_ms_ = 5000;
|
uint32_t disconnect_delay_ms_ = 5000;
|
||||||
uint16_t validity_period_ = 300;
|
uint16_t validity_period_ = 300;
|
||||||
uint16_t bignum_ = 0;
|
int16_t bignum_ = 0;
|
||||||
uint16_t smallnum_ = 0;
|
int16_t smallnum_ = 0;
|
||||||
uint8_t cfg_ = 0;
|
uint8_t cfg_ = 0;
|
||||||
|
|
||||||
void setcfgbit_(uint8_t bit, bool value);
|
void setcfgbit_(uint8_t bit, bool value);
|
||||||
|
|||||||
Reference in New Issue
Block a user