mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 21:44:55 +01:00
Remove warnings when falling through switch cases on purpose (#4181)
This commit is contained in:
parent
c47dc09d34
commit
24bf3674f3
1 changed files with 5 additions and 0 deletions
|
@ -290,14 +290,17 @@ float BLEClientBase::parse_char_value(uint8_t *value, uint16_t length) {
|
||||||
if (length > 2) {
|
if (length > 2) {
|
||||||
return (float) encode_uint16(value[1], value[2]);
|
return (float) encode_uint16(value[1], value[2]);
|
||||||
}
|
}
|
||||||
|
// fall through
|
||||||
case 0x7: // uint24.
|
case 0x7: // uint24.
|
||||||
if (length > 3) {
|
if (length > 3) {
|
||||||
return (float) encode_uint24(value[1], value[2], value[3]);
|
return (float) encode_uint24(value[1], value[2], value[3]);
|
||||||
}
|
}
|
||||||
|
// fall through
|
||||||
case 0x8: // uint32.
|
case 0x8: // uint32.
|
||||||
if (length > 4) {
|
if (length > 4) {
|
||||||
return (float) encode_uint32(value[1], value[2], value[3], value[4]);
|
return (float) encode_uint32(value[1], value[2], value[3], value[4]);
|
||||||
}
|
}
|
||||||
|
// fall through
|
||||||
case 0xC: // int8.
|
case 0xC: // int8.
|
||||||
return (float) ((int8_t) value[1]);
|
return (float) ((int8_t) value[1]);
|
||||||
case 0xD: // int12.
|
case 0xD: // int12.
|
||||||
|
@ -305,10 +308,12 @@ float BLEClientBase::parse_char_value(uint8_t *value, uint16_t length) {
|
||||||
if (length > 2) {
|
if (length > 2) {
|
||||||
return (float) ((int16_t)(value[1] << 8) + (int16_t) value[2]);
|
return (float) ((int16_t)(value[1] << 8) + (int16_t) value[2]);
|
||||||
}
|
}
|
||||||
|
// fall through
|
||||||
case 0xF: // int24.
|
case 0xF: // int24.
|
||||||
if (length > 3) {
|
if (length > 3) {
|
||||||
return (float) ((int32_t)(value[1] << 16) + (int32_t)(value[2] << 8) + (int32_t)(value[3]));
|
return (float) ((int32_t)(value[1] << 16) + (int32_t)(value[2] << 8) + (int32_t)(value[3]));
|
||||||
}
|
}
|
||||||
|
// fall through
|
||||||
case 0x10: // int32.
|
case 0x10: // int32.
|
||||||
if (length > 4) {
|
if (length > 4) {
|
||||||
return (float) ((int32_t)(value[1] << 24) + (int32_t)(value[2] << 16) + (int32_t)(value[3] << 8) +
|
return (float) ((int32_t)(value[1] << 24) + (int32_t)(value[2] << 16) + (int32_t)(value[3] << 8) +
|
||||||
|
|
Loading…
Reference in a new issue