diff --git a/components/pca9685/pca9685_intf.c b/components/pca9685/pca9685_intf.c index ecd513e..af51e47 100644 --- a/components/pca9685/pca9685_intf.c +++ b/components/pca9685/pca9685_intf.c @@ -245,6 +245,6 @@ void pca9685_interface_debug_print(const char *const fmt, ...) { va_list list; va_start(list, fmt); - esp_log_writev(ESP_LOG_DEBUG, "sub_pca9685", fmt, list); + esp_log_writev(ESP_LOG_INFO, "sub_pca9685", fmt, list); va_end(list); } diff --git a/components/protobuf_rpc/Kconfig.projbuild b/components/protobuf_rpc/Kconfig.projbuild index 134e0a3..04d2e25 100644 --- a/components/protobuf_rpc/Kconfig.projbuild +++ b/components/protobuf_rpc/Kconfig.projbuild @@ -40,53 +40,61 @@ menu "SUB:ProtoBuf-RPC" endmenu menu "Thruster" - config SUB_PROTOBUF_THRUSTER0_PIN - int "Thruster0 pin" - default 25 + config SUB_PROTOBUF_THRUSTERS_ENABLE + bool "Enable thrusters" + default y help - The pin of thruster channel 0. + Enable thrusters. - config SUB_PROTOBUF_THRUSTER1_PIN - int "Thruster1 pin" - default 26 - help - The pin of thruster channel 1. + if SUB_PROTOBUF_THRUSTERS_ENABLE + config SUB_PROTOBUF_THRUSTER0_PIN + int "Thruster0 pin" + default 25 + help + The pin of thruster channel 0. - config SUB_PROTOBUF_THRUSTER2_PIN - int "Thruster2 pin" - default 27 - help - The pin of thruster channel 2. + config SUB_PROTOBUF_THRUSTER1_PIN + int "Thruster1 pin" + default 26 + help + The pin of thruster channel 1. - config SUB_PROTOBUF_THRUSTER3_PIN - int "Thruster3 pin" - default 14 - help - The pin of thruster channel 3. + config SUB_PROTOBUF_THRUSTER2_PIN + int "Thruster2 pin" + default 27 + help + The pin of thruster channel 2. - config SUB_PROTOBUF_THRUSTER4_PIN - int "Thruster4 pin" - default 12 - help - The pin of thruster channel 4. + config SUB_PROTOBUF_THRUSTER3_PIN + int "Thruster3 pin" + default 14 + help + The pin of thruster channel 3. - config SUB_PROTOBUF_THRUSTER5_PIN - int "Thruster5 pin" - default 13 - help - The pin of thruster channel 5. + config SUB_PROTOBUF_THRUSTER4_PIN + int "Thruster4 pin" + default 12 + help + The pin of thruster channel 4. - config SUB_PROTOBUF_THRUSTER6_PIN - int "Thruster6 pin" - default 15 - help - The pin of thruster channel 6. + config SUB_PROTOBUF_THRUSTER5_PIN + int "Thruster5 pin" + default 13 + help + The pin of thruster channel 5. - config SUB_PROTOBUF_THRUSTER7_PIN - int "Thruster7 pin" - default 2 - help - The pin of thruster channel 7. + config SUB_PROTOBUF_THRUSTER6_PIN + int "Thruster6 pin" + default 15 + help + The pin of thruster channel 6. + + config SUB_PROTOBUF_THRUSTER7_PIN + int "Thruster7 pin" + default 2 + help + The pin of thruster channel 7. + endif endmenu endmenu diff --git a/components/protobuf_rpc/message_cmd.c b/components/protobuf_rpc/message_cmd.c index 7a4dacb..90fa643 100644 --- a/components/protobuf_rpc/message_cmd.c +++ b/components/protobuf_rpc/message_cmd.c @@ -12,9 +12,11 @@ static const char *TAG = "protobuf_commu_rpc_cmd"; static dshot_handle_t dshot_chan0, dshot_chan1, dshot_chan2, dshot_chan3, dshot_chan4, dshot_chan5, dshot_chan6, dshot_chan7; +#if CONFIG_SUB_PROTOBUF_THRUSTERS_ENABLE static int thruster_init(void) { int ret = 0; + ret += rmt_dshot_init(&dshot_chan0, CONFIG_SUB_PROTOBUF_THRUSTER0_PIN); ret += rmt_dshot_init(&dshot_chan1, CONFIG_SUB_PROTOBUF_THRUSTER1_PIN); ret += rmt_dshot_init(&dshot_chan2, CONFIG_SUB_PROTOBUF_THRUSTER2_PIN); @@ -25,7 +27,7 @@ static int thruster_init(void) ret += rmt_dshot_init(&dshot_chan7, CONFIG_SUB_PROTOBUF_THRUSTER7_PIN); return ret; } - +#endif #if CONFIG_SUB_ENABLE_PCA9685 static int pwmDev_init(void) { @@ -39,7 +41,9 @@ static int pwmDev_init(void) int message_cmd_init(void) { int ret = 0; +#if CONFIG_SUB_PROTOBUF_THRUSTERS_ENABLE ret += thruster_init(); +#endif #if CONFIG_SUB_ENABLE_PCA9685 ret += pwmDev_init(); #endif @@ -49,6 +53,9 @@ int message_cmd_init(void) void message_thruster_cmd(ThrusterCommand *msg) { +#if !CONFIG_SUB_PROTOBUF_THRUSTERS_ENABLE + return; +#endif if (msg->has_throttle0) { ESP_LOGI(TAG, "dshot_chan0: %ld", msg->throttle0);