Compare commits

..

2 Commits

Author SHA1 Message Date
crosstyan 4fb41a3211 feat(llcc68): honor directional TX settings
Apply the SX126x IQ config register fix after each LoRa packet parameter update so standard and inverted IQ changes take effect.

Reapply TX power settings in LoRa and GFSK async flush paths so a TX profile can differ from the RX/init profile.
2026-05-29 19:40:56 +08:00
crosstyan d4709da971 fix(llcc68): encode LoRa packet params in datasheet order
Program SetPacketParams as preamble, header type, payload length, CRC type, and IQ type.

The previous order swapped packet fields, which made gateway LoRa TX frames decode as corrupted fixed-length payloads on the CH32 LLCC68 receiver.
2026-05-29 19:40:55 +08:00
+13 -3
View File
@@ -874,12 +874,14 @@ LLCC68::set_packet_params(uint16_t preamble_length, uint8_t payload_length,
const uint8_t data[] = {
static_cast<uint8_t>((preamble_length >> 8) & 0xFF),
static_cast<uint8_t>(preamble_length & 0xFF),
crc_type,
payload_length,
hdr_type,
payload_length,
crc_type,
iq_type,
};
return write_stream(RADIOLIB_SX126X_CMD_SET_PACKET_PARAMS, data);
auto r = write_stream(RADIOLIB_SX126X_CMD_SET_PACKET_PARAMS, data);
APP_RADIO_RETURN_ERR(r);
return fix_inverted_iq(iq_type);
}
expected<unit, error_code>
@@ -1307,6 +1309,10 @@ LLCC68::hal_async_flush(lora_parameters_t params) {
params.packet_params.hdr_type,
params.packet_params.iq_type),
"tx::set_packet_params");
auto chip_type_ = hal_get_chip_type();
APP_RADIO_RETURN_ERR_CTX(chip_type_, "tx::get_chip_type");
APP_RADIO_RETURN_ERR_CTX(hal_set_output_power(*chip_type_, params.tx_params),
"tx::hal_set_output_power");
APP_RADIO_RETURN_ERR_CTX(set_buffer_base_address(),
"tx::set_buffer_base_address");
APP_RADIO_RETURN_ERR_CTX(flush_tx_buffer(), "tx::flush_tx_buffer");
@@ -1360,6 +1366,10 @@ LLCC68::hal_gfsk_async_flush(gfsk_parameters_t params) {
packet_params.payload_length = static_cast<uint8_t>(data().tx_xfer_size);
APP_RADIO_RETURN_ERR_CTX(set_gfsk_packet_params(packet_params),
"gfsk_tx::set_packet_params");
auto chip_type_ = hal_get_chip_type();
APP_RADIO_RETURN_ERR_CTX(chip_type_, "gfsk_tx::get_chip_type");
APP_RADIO_RETURN_ERR_CTX(hal_set_output_power(*chip_type_, params.tx_params),
"gfsk_tx::hal_set_output_power");
APP_RADIO_RETURN_ERR_CTX(set_buffer_base_address(),
"gfsk_tx::set_buffer_base_address");
APP_RADIO_RETURN_ERR_CTX(flush_tx_buffer(), "gfsk_tx::flush_tx_buffer");