Skip to content

Commit ee67c00

Browse files
authored
Merge pull request #486 from FrameworkComputer/hx20.fix_version
hx20. fix board version for tp audio
2 parents fa89820 + aca0174 commit ee67c00

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

board/hx20/board.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -767,22 +767,26 @@ BUILD_ASSERT(ARRAY_SIZE(hx20_board_versions) == BOARD_VERSION_COUNT);
767767

768768
int get_hardware_id(enum adc_channel channel)
769769
{
770-
int version = BOARD_VERSION_UNKNOWN;
770+
int version[ADC_CH_COUNT] = {BOARD_VERSION_UNKNOWN};
771771
int mv;
772772
int i;
773773

774-
mv = adc_read_channel(ADC_AD_BID);
774+
if (channel >= ADC_CH_COUNT) {
775+
return BOARD_VERSION_UNKNOWN;
776+
}
777+
778+
mv = adc_read_channel(channel);
775779

776780
if (mv == ADC_READ_ERROR)
777781
return BOARD_VERSION_UNKNOWN;
778782

779783
for (i = 0; i < BOARD_VERSION_COUNT; i++)
780784
if (mv < hx20_board_versions[i].thresh_mv) {
781-
version = hx20_board_versions[i].version;
782-
return version;
785+
version[channel] = hx20_board_versions[i].version;
786+
return version[channel];
783787
}
784788

785-
return version;
789+
return version[channel];
786790
}
787791

788792
int board_get_version(void)

0 commit comments

Comments
 (0)