From 6d197312742d9091b1d035f110fd7271f2399df0 Mon Sep 17 00:00:00 2001 From: "Morgan 'ARR\\!' Allen" Date: Sat, 22 Feb 2020 11:07:02 -0800 Subject: [PATCH] clarify and remove old logging --- main/esp32-lora.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/main/esp32-lora.c b/main/esp32-lora.c index 5245422..8f576b2 100644 --- a/main/esp32-lora.c +++ b/main/esp32-lora.c @@ -110,13 +110,15 @@ void lora23_set_implicit_header(lora32_cfg_t *lora) { } void lora32_idle(lora32_cfg_t *lora) { + ESP_LOGD(TAG, "MODE_STANDBY"); + lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_STANDBY); } void lora32_sleep(lora32_cfg_t *lora) { - lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP); + ESP_LOGD(TAG, "MODE_SLEEP"); - //ESP_LOGI(TAG, "REG_OP_MODE: 0x%2X", lora32_read_reg(spi, REG_OP_MODE)); + lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_SLEEP); } void lora32_enable_tx(lora32_cfg_t *lora) { @@ -144,8 +146,6 @@ void lora32_send(lora32_cfg_t *lora, uint8_t *data, uint8_t len) { lora32_write_reg(lora, REG_PAYLOAD_LENGTH, len); lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_TX); - - ESP_LOGD(TAG, "lora32_send waiting for TX to finish"); } void lora32_set_frequency(lora32_cfg_t *lora, long frequency) { @@ -234,7 +234,7 @@ void lora32_set_spreadfactor(lora32_cfg_t *lora, uint8_t factor) { } void lora32_enable_continuous_rx(lora32_cfg_t *lora) { - ESP_LOGD(TAG, "enabling continuous receive"); + ESP_LOGD(TAG, "MODE_RX_CONTINUOUS"); if(lora->receive != NULL) { lora32_write_reg(lora, REG_DIO_MAPPING_1, DIO0_MODE_RXDONE); @@ -250,7 +250,7 @@ void lora32_enable_cad(lora32_cfg_t *lora) { lora32_write_reg(lora, REG_DIO_MAPPING_1, DIO0_MODE_CADDET); } - ESP_LOGD(TAG, "Enabling CAD Detection Mode"); + ESP_LOGD(TAG, "MODE_CAD_DETECT"); lora32_write_reg(lora, REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_CAD_DETECT); } @@ -407,16 +407,15 @@ uint8_t lora32_init(lora32_cfg_t *lora) { ESP_LOGI(TAG, "set lna: 0x%2X", lna | 0x03); lora32_write_reg(lora, REG_MODEM_CONFIG_3, 0x04); - //ESP_LOGI(TAG, "REG_MODEM_CONFIG_3: 0x%2X", lora32_read_reg(spi, REG_MODEM_CONFIG_3)); + // TODO make based on config lora32_set_tx_power(lora, 17, PA_OUTPUT_PA_BOOST_PIN); ESP_LOGI(TAG, "lora32_set_tx_power"); lora32_idle(lora); ESP_LOGI(TAG, "lora32_idle"); - //ESP_LOGI(TAG, "REG_OP_MODE: 0x%2X", lora32_read_reg(spi, REG_OP_MODE)); - + // TODO setup shouldn't be based on just receive callback if(lora->receive != NULL) { ESP_LOGI(TAG, "Setting callback handler");