Rename CurrentVCC->CurrentBandgapVoltage

and tune surrounding comments
pull/265/head
D.R.racer 2023-03-08 11:59:25 +01:00
parent 12dd0bdd90
commit 029e0ecfc0
3 changed files with 9 additions and 6 deletions

View File

@ -142,7 +142,7 @@ void Panic(ErrorCode ec) {
void RuntimeHWChecks() {
mv::vcc.Step();
if (mv::vcc.CurrentVCC() > config::VCCADCThreshold) {
if (mv::vcc.CurrentBandgapVoltage() > config::VCCADCThreshold) {
// stop all motors at once
mm::motion.AbortPlannedMoves();
// kill all TMC

View File

@ -14,7 +14,10 @@ namespace voltage {
/// - AVCC=5V, you get VAL=225.06
/// - AVCC=4.1V, you get VAL=274.46
/// - AVCC=4V, you get VAL=281.35
/// - any lower and the board will probably die sooner than being able to report anything
///
/// Any lower and the board will probably die sooner than being able to report anything.
/// The TMC will die, but the atmega32u4 seems to be a bit more resilient.
/// It's still out of spec anyway since the atmega32u4 is rated for 16MHz only at >4.5V.
class VCC {
public:
inline constexpr VCC()
@ -23,9 +26,9 @@ public:
/// Reads the ADC, checks the value
void Step();
/// @returns the current VCC voltage level, platform dependent.
/// @returns the current bandgap voltage level, platform dependent.
/// @note see VCC measurement setup in config.h
uint16_t CurrentVCC() const { return vcc_val; }
uint16_t CurrentBandgapVoltage() const { return vcc_val; }
private:
uint16_t vcc_val;

View File

@ -164,7 +164,7 @@
| 0x1eh 30 | uint16 | Set/Get Pulley iRun current| 0-31 | 14h 20 | 20->350mA: see TMC2130 current conversion| Read / Write | M707 A0x1e | M708 A0x1e Xn
| 0x1fh 31 | uint16 |Set/Get Selector iRun current| 0-31 | 1fh 31 | 31->530mA: see TMC2130 current conversion| Read / Write | M707 A0x1f | M708 A0x1f Xn
| 0x20h 32 | uint16 | Set/Get Idler iRun current | 0-31 | 1fh 31 | 31->530mA: see TMC2130 current conversion| Read / Write | M707 A0x20 | M708 A0x20 Xn
| 0x21h 33 | uint16 | Current VCC voltage level | 225-281 | | 225->5V, 281->4V, higher values mean lower voltage and the board would probably die sooner than reporting anything | Read only | M707 A0x21 | N/A
| 0x21h 33 | uint16 | Current bandgap voltage level | 225-281 | | 225->5V, 281->4V, higher values mean lower voltage and the board would probably die sooner than reporting anything | Read only | M707 A0x21 | N/A
*/
struct RegisterFlags {
@ -398,7 +398,7 @@ static const RegisterRec registers[] /*PROGMEM*/ = {
1),
// 0x21 Current VCC voltage level R
RegisterRec(
[]() -> uint16_t { return mv::vcc.CurrentVCC(); },
[]() -> uint16_t { return mv::vcc.CurrentBandgapVoltage(); },
2),
};