AP_Compass: use memcmp to check whoami result code from HMC5843 device

Co-authored-by: muramura <ma2maru@gmail.com>
This commit is contained in:
Peter Barker 2024-09-22 13:14:54 +10:00 committed by Andrew Tridgell
parent 77067edd91
commit 3e1ad5dab6
1 changed files with 1 additions and 3 deletions

View File

@ -334,9 +334,7 @@ bool AP_Compass_HMC5843::_check_whoami()
// can't talk on bus
return false;
}
if (id[0] != 'H' ||
id[1] != '4' ||
id[2] != '3') {
if (memcmp(id, "H43", 3) != 0) {
// not a HMC5x83 device
return false;
}