.ttl = ttl,
.credential = cred_flag,
.period = period,
- .count = retransmit >> 5,
- .interval = ((0x1f & retransmit) + 1) * 50
+ .count = retransmit & 0x7,
+ .interval = ((retransmit >> 3) + 1) * 50
};
if (b_virt)
if (size != 2 || pkt[0] > 0x01)
return true;
- count = (pkt[1] >> 5) + 1;
- interval = ((pkt[1] & 0x1f) + 1) * 10;
+ count = (pkt[1] & 0x7) + 1;
+ interval = ((pkt[1] >> 3) + 1) * 10;
node_relay_mode_set(node, !!pkt[0], count, interval);
/* Fall Through */
n = mesh_model_opcode_set(OP_CONFIG_RELAY_STATUS, msg);
msg[n++] = node_relay_mode_get(node, &count, &interval);
- msg[n++] = ((count - 1) << 5) + ((interval/10 - 1) & 0x1f);
+ msg[n++] = (count - 1) + ((interval/10 - 1) << 3);
l_debug("Get/Set Relay Config (%d)", msg[n-1]);
break;
if (size != 1)
return true;
- count = (pkt[0] >> 5) + 1;
- interval = ((pkt[0] & 0x1f) + 1) * 10;
+ count = (pkt[0] & 0x7) + 1;
+ interval = ((pkt[0] >> 3) + 1) * 10;
if (mesh_config_write_net_transmit(node_config_get(node), count,
interval))
n = mesh_model_opcode_set(OP_CONFIG_NETWORK_TRANSMIT_STATUS,
msg);
mesh_net_transmit_params_get(net, &count, &interval);
- msg[n++] = ((count - 1) << 5) + ((interval/10 - 1) & 0x1f);
+ msg[n++] = (count - 1) + ((interval/10 - 1) << 3);
l_debug("Get/Set Network Transmit Config");
break;
if (pub && (pub->virt || !(IS_UNASSIGNED(pub->addr)))) {
uint8_t mod_addr[2];
uint8_t *pub_addr;
- uint8_t retransmit = (pub->count << 5) +
- (pub->interval / 50 - 1);
+ uint8_t retransmit = pub->count +
+ ((pub->interval / 50 - 1) << 3);
/* Add publication */
l_put_le16(pub->addr, &mod_addr);
return true;
bt_shell_printf("Node %4.4x: Relay 0x%02x, cnt %d, steps %d\n",
- src, data[0], data[1]>>5, data[1] & 0x1f);
+ src, data[0], data[1] & 0x7, data[1] >> 3);
break;
case OP_CONFIG_PROXY_STATUS:
break;
}
- bt_shell_printf("Rexmit count\t%d\n", data[9] >> 5);
- bt_shell_printf("Rexmit steps\t%d\n", data[9] & 0x1f);
+ bt_shell_printf("Rexmit count\t%d\n", data[9] & 0x7);
+ bt_shell_printf("Rexmit steps\t%d\n", data[9] >> 3);
break;
}
msg[n++] = parms[0];
- msg[n++] = (parms[1] << 5) | parms[2];
+ msg[n++] = parms[1] | (parms[2] << 3);
if (!config_send(msg, n, OP_CONFIG_RELAY_SET))
return bt_shell_noninteractive_quit(EXIT_FAILURE);