Skip to content

Commit

Permalink
Berry fix walrus operator (#22685)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Dec 19, 2024
1 parent af724a6 commit fde529f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.

### Fixed
- Berry Zigbee fix wrong attributes (#22684)
- Berry fix walrus operator

### Removed

Expand Down
2 changes: 2 additions & 0 deletions lib/libesp32/berry/src/be_code.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,8 @@ int be_code_setvar(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2, bbool keep_reg)
free_expreg(finfo, e2); /* free source (checks only ETREG) */
*e2 = *e1; /* now e2 is e1 ETLOCAL */
}
} else {
*e2 = *e1; /* ETLOCAL wins over ETREG */
}
break;
case ETGLOBAL: /* store to grobal R(A) -> G(Bx) by global index */
Expand Down
14 changes: 5 additions & 9 deletions lib/libesp32/berry_tasmota/src/embedded/zigbee_zcl_attribute.be
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,11 @@ class zcl_attribute_list : zcl_attribute_list_ntv
var v

# shortaddr
v = self.shortaddr
if v != nil
if (v := self.shortaddr) != nil
items.push(f'"Device":"0x{v:04X}"')
end
# groupaddr
v = self.groupaddr
if v != nil
if (v := self.groupaddr) != nil
items.push(f'"Group":"0x{v:04X}"')
end

Expand All @@ -225,15 +223,13 @@ class zcl_attribute_list : zcl_attribute_list_ntv
end

# Endpoint
v = self.src_ep
if v != nil
if (v := self.src_ep) != nil
items.push(f'"Endpoint":{v}')
end

# LQI
v := self.lqi
if v != nil
items.push(f'"LinkQuality":{v:i}')
if (v := self.lqi) != nil
items.push(f'"LinkQuality":{v}')
end

var s = "{" + items.concat(",") + "}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static const bvalue be_ktab_class_zcl_attribute_list[27] = {
/* K19 */ be_nested_str_weak(tostring),
/* K20 */ be_const_int(1),
/* K21 */ be_nested_str_weak(_X22Endpoint_X22_X3A_X25s),
/* K22 */ be_nested_str_weak(_X22LinkQuality_X22_X3A_X25i),
/* K22 */ be_nested_str_weak(_X22LinkQuality_X22_X3A_X25s),
/* K23 */ be_nested_str_weak(_X7B),
/* K24 */ be_nested_str_weak(concat),
/* K25 */ be_nested_str_weak(_X2C),
Expand Down

0 comments on commit fde529f

Please sign in to comment.