Matter fix Illuminance to uint (#18830)

This commit is contained in:
s-hadinger 2023-06-09 08:55:43 +02:00 committed by GitHub
parent 676165f3f6
commit 138b119c6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View File

@ -73,14 +73,14 @@ class Matter_Plugin_Bridge_Sensor_Illuminance : Matter_Plugin_Bridge_Sensor
if cluster == 0x0400 # ========== Illuminance Measurement 2.2 p.95 ==========
if attribute == 0x0000 # ---------- MeasuredValue / i16 ----------
if self.shadow_value != nil
return TLV.create_TLV(TLV.I2, int(self.shadow_value))
return TLV.create_TLV(TLV.U2, int(self.shadow_value))
else
return TLV.create_TLV(TLV.NULL, nil)
end
elif attribute == 0x0001 # ---------- MinMeasuredValue / i16 ----------
return TLV.create_TLV(TLV.I2, 0) # 0 lux
return TLV.create_TLV(TLV.U2, 1) # 1 lux
elif attribute == 0x0002 # ---------- MaxMeasuredValue / i16 ----------
return TLV.create_TLV(TLV.I2, 10000) # 10000 lux
return TLV.create_TLV(TLV.U2, 0xFFFE)
elif attribute == 0xFFFC # ---------- FeatureMap / map32 ----------
return TLV.create_TLV(TLV.U4, 0)
elif attribute == 0xFFFD # ---------- ClusterRevision / u2 ----------

View File

@ -72,14 +72,14 @@ class Matter_Plugin_Sensor_Illuminance : Matter_Plugin_Sensor
if cluster == 0x0400 # ========== Illuminance Measurement 2.2 p.95 ==========
if attribute == 0x0000 # ---------- MeasuredValue / i16 ----------
if self.shadow_value != nil
return TLV.create_TLV(TLV.I2, int(self.shadow_value))
return TLV.create_TLV(TLV.U2, int(self.shadow_value))
else
return TLV.create_TLV(TLV.NULL, nil)
end
elif attribute == 0x0001 # ---------- MinMeasuredValue / i16 ----------
return TLV.create_TLV(TLV.I2, 0) # 0 lux
return TLV.create_TLV(TLV.U2, 1) # 1 lux
elif attribute == 0x0002 # ---------- MaxMeasuredValue / i16 ----------
return TLV.create_TLV(TLV.I2, 10000) # 10000 lux
return TLV.create_TLV(TLV.U2, 0xFFFE)
elif attribute == 0xFFFC # ---------- FeatureMap / map32 ----------
return TLV.create_TLV(TLV.U4, 0)
elif attribute == 0xFFFD # ---------- ClusterRevision / u2 ----------

View File

@ -74,7 +74,7 @@ be_local_closure(Matter_Plugin_Bridge_Sensor_Illuminance_read_attribute, /* na
/* K5 */ be_const_int(0),
/* K6 */ be_nested_str_weak(shadow_value),
/* K7 */ be_nested_str_weak(create_TLV),
/* K8 */ be_nested_str_weak(I2),
/* K8 */ be_nested_str_weak(U2),
/* K9 */ be_nested_str_weak(NULL),
/* K10 */ be_const_int(1),
/* K11 */ be_const_int(2),
@ -117,7 +117,7 @@ be_local_closure(Matter_Plugin_Bridge_Sensor_Illuminance_read_attribute, /* na
0x781E0005, // 001D JMPF R7 #0024
0x8C1C0907, // 001E GETMET R7 R4 K7
0x88240908, // 001F GETMBR R9 R4 K8
0x58280005, // 0020 LDCONST R10 K5
0x5828000A, // 0020 LDCONST R10 K10
0x7C1C0600, // 0021 CALL R7 3
0x80040E00, // 0022 RET 1 R7
0x70020018, // 0023 JMP #003D
@ -125,7 +125,7 @@ be_local_closure(Matter_Plugin_Bridge_Sensor_Illuminance_read_attribute, /* na
0x781E0005, // 0025 JMPF R7 #002C
0x8C1C0907, // 0026 GETMET R7 R4 K7
0x88240908, // 0027 GETMBR R9 R4 K8
0x542A270F, // 0028 LDINT R10 10000
0x542AFFFD, // 0028 LDINT R10 65534
0x7C1C0600, // 0029 CALL R7 3
0x80040E00, // 002A RET 1 R7
0x70020010, // 002B JMP #003D

View File

@ -28,7 +28,7 @@ be_local_closure(Matter_Plugin_Sensor_Illuminance_read_attribute, /* name */
/* K5 */ be_const_int(0),
/* K6 */ be_nested_str_weak(shadow_value),
/* K7 */ be_nested_str_weak(create_TLV),
/* K8 */ be_nested_str_weak(I2),
/* K8 */ be_nested_str_weak(U2),
/* K9 */ be_nested_str_weak(NULL),
/* K10 */ be_const_int(1),
/* K11 */ be_const_int(2),
@ -71,7 +71,7 @@ be_local_closure(Matter_Plugin_Sensor_Illuminance_read_attribute, /* name */
0x781E0005, // 001D JMPF R7 #0024
0x8C1C0907, // 001E GETMET R7 R4 K7
0x88240908, // 001F GETMBR R9 R4 K8
0x58280005, // 0020 LDCONST R10 K5
0x5828000A, // 0020 LDCONST R10 K10
0x7C1C0600, // 0021 CALL R7 3
0x80040E00, // 0022 RET 1 R7
0x70020018, // 0023 JMP #003D
@ -79,7 +79,7 @@ be_local_closure(Matter_Plugin_Sensor_Illuminance_read_attribute, /* name */
0x781E0005, // 0025 JMPF R7 #002C
0x8C1C0907, // 0026 GETMET R7 R4 K7
0x88240908, // 0027 GETMBR R9 R4 K8
0x542A270F, // 0028 LDINT R10 10000
0x542AFFFD, // 0028 LDINT R10 65534
0x7C1C0600, // 0029 CALL R7 3
0x80040E00, // 002A RET 1 R7
0x70020010, // 002B JMP #003D