refine codes.

This commit is contained in:
pandx 2024-11-25 17:30:19 +08:00
parent 6a80e9415f
commit 98f07e1def

View File

@ -834,25 +834,7 @@ void Uart::DealWave() {
float Uart::Calcoe(int ran, int iChannel, std::string &product, int range) { float Uart::Calcoe(int ran, int iChannel, std::string &product, int range) {
float coe = 0.0f; float coe = 0.0f;
if (product == "01") { if (product == "01") {
switch (ran) { coe = pow(2, ran) * 8.0f / 32767;
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;
}
} else if (product == "02") { } else if (product == "02") {
if (iChannel == WAVE_X || iChannel == WAVE_Y) { if (iChannel == WAVE_X || iChannel == WAVE_Y) {
coe = 0.00048828125f; coe = 0.00048828125f;