mirror of
https://github.com/esphome/esphome.git
synced 2026-10-04 10:09:13 +00:00
Merge remote-tracking branch 'upstream/fast-millis-esp32' into integration
This commit is contained in:
@@ -145,3 +145,19 @@ display:
|
||||
it.filled_rectangle(0, 0, it.get_width(), it.get_height(), Color::WHITE);
|
||||
it.circle(it.get_width() / 2, it.get_height() / 2, 30, Color::BLACK);
|
||||
it.circle(it.get_width() / 2, it.get_height() / 2, 20, Color(255, 0, 0));
|
||||
|
||||
- platform: epaper_spi
|
||||
spi_id: spi_bus
|
||||
model: goodisplay-gdey042t81-4.2
|
||||
cs_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO5
|
||||
dc_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO17
|
||||
reset_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO16
|
||||
busy_pin:
|
||||
allow_other_uses: true
|
||||
number: GPIO4
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "esphome/components/modbus/modbus_helpers.h"
|
||||
|
||||
namespace esphome::modbus::helpers {
|
||||
|
||||
TEST(ModbusHelpersTest, PayloadToNumberRejectsOffsetAtEndOfBuffer) {
|
||||
const std::vector<uint8_t> data{0x12, 0x34};
|
||||
EXPECT_EQ(payload_to_number(data, SensorValueType::U_WORD, 2, 0xFFFFFFFF), 0);
|
||||
}
|
||||
|
||||
TEST(ModbusHelpersTest, PayloadToNumberRejectsTruncatedMultiRegisterValue) {
|
||||
const std::vector<uint8_t> data{0x12, 0x34, 0x56};
|
||||
EXPECT_EQ(payload_to_number(data, SensorValueType::U_DWORD, 0, 0xFFFFFFFF), 0);
|
||||
}
|
||||
|
||||
TEST(ModbusHelpersTest, PayloadToNumberDecodesValidWord) {
|
||||
const std::vector<uint8_t> data{0x12, 0x34};
|
||||
EXPECT_EQ(payload_to_number(data, SensorValueType::U_WORD, 0, 0xFFFFFFFF), 0x1234);
|
||||
}
|
||||
|
||||
} // namespace esphome::modbus::helpers
|
||||
@@ -3,6 +3,22 @@ esphome:
|
||||
then:
|
||||
- rtttl.play: 'siren:d=8,o=5,b=100:d,e,d,e,d,e,d,e'
|
||||
- rtttl.stop
|
||||
# Test all note features: all notes, denominators (1,2,4,8,16,32), sharp (#), octaves (4-7), dotted (.), note gap (c5,c5), pause (p)
|
||||
- rtttl.play: 'special:d=4,o=5,b=120:1c4,2d#5,4e6.,8f#7,16g4,32a5,8a#5,4b6,8h5,c5,c5,8p,2c4'
|
||||
# Different orders of control parameters
|
||||
- rtttl.play: 'test_odb:o=5,d=8,b=100:c'
|
||||
- rtttl.play: 'test_bod:b=100,o=5,d=8:c'
|
||||
- rtttl.play: 'test_bdo:b=100,d=8,o=5:c'
|
||||
- rtttl.play: 'test_obd:o=5,b=100,d=8:c'
|
||||
- rtttl.play: 'test_dbo:d=8,b=100,o=5:c'
|
||||
# Missing parameters (use defaults)
|
||||
- rtttl.play: 'test_no_d:o=5,b=100:c'
|
||||
- rtttl.play: 'test_no_o:d=8,b=100:c'
|
||||
- rtttl.play: 'test_no_b:d=8,o=5:c'
|
||||
- rtttl.play: 'test_only_d:d=8:c'
|
||||
- rtttl.play: 'test_only_o:o=5:c'
|
||||
- rtttl.play: 'test_only_b:b=100:c'
|
||||
- rtttl.play: 'test_empty::c'
|
||||
|
||||
output:
|
||||
- platform: ${output_platform}
|
||||
|
||||
Reference in New Issue
Block a user