From 98f07e1defb92705816b04375493e2d5e27a17ff Mon Sep 17 00:00:00 2001 From: pandx Date: Mon, 25 Nov 2024 17:30:19 +0800 Subject: [PATCH] refine codes. --- uart/uart_feature_parse.cpp | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/uart/uart_feature_parse.cpp b/uart/uart_feature_parse.cpp index 9da72be..3bab043 100644 --- a/uart/uart_feature_parse.cpp +++ b/uart/uart_feature_parse.cpp @@ -834,25 +834,7 @@ void Uart::DealWave() { float Uart::Calcoe(int ran, int iChannel, std::string &product, int range) { float coe = 0.0f; if (product == "01") { - switch (ran) { - case 0: { - range = 8; - coe = 8 * 1.0f / 32767; - } break; - case 1: { - range = 16; - coe = 16 * 1.0f / 32767; - } break; - case 2: { - range = 32; - coe = 32 * 1.0f / 32767; - } break; - case 3: { - range = 64; - coe = 64 * 1.0f / 32767; - } break; - } - + coe = pow(2, ran) * 8.0f / 32767; } else if (product == "02") { if (iChannel == WAVE_X || iChannel == WAVE_Y) { coe = 0.00048828125f;