Comments in AS5600.cpp incorrect in detectMagnet and getMagnetStrength()
steve-arnold opened this issue · comments
Describe the bug
Not really a bug but inaccuracies in the comments which confused me
To Reproduce
In the function int AMS_5600::detectMagnet() and AMS_5600::getMagnetStrength()
The comments describing the status register does not correspond with the way the code is working which is confusing.
The incorrect comments :-
/0 0 MD ML MH 0 0 0/
/* MD high = AGC minimum overflow, Magnet to strong /
/ ML high = AGC Maximum overflow, magnet to weak*/
/* MH high = magnet detected*/
Purpose of the bits is really self explanatory MD Magnet Detected, ML Magnet Low, MH Magnet High
I suggest that the comments be amended to match the published datasheet as follows.
It should be
/0 0 MD ML MH 0 0 0/
/* MD high = Magnet was detected*/
/* ML high = AGC maximum gain overflow, magnet too weak*/
/* MH high = AGC minimum gain overflow, magnet too strong*/
This should be done in both detectMagnet() and getMagnetStrength() functions.
Additionally, the header for detectMagnet is incorrect being-
/*******************************************************
/* Method: detectMagnet
/* In: none
/* Out: 1 if magnet is detected, 0 if not
/* Description: reads status register and examines the
/* MH bit
//
It should read :-
/
/* Method: detectMagnet
/* In: none
/* Out: 1 if magnet is detected, 0 if not
/* Description: reads status register and examines the
/* MD bit
/*******************************************************/
Expected behavior
See texy above
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.
Another typo in the header for the function readTwoBytes. The header comments state that the function in readOneByte.
Can you send us a PR about this? @steve-arnold
PR made and changes have been merged. Thank you.