Minor changes in aftb_vpp.h

Added a dummy conversation after setting the analog reference
Print out pot type (4131/4151) if VPP_VERBOSE is set
This commit is contained in:
HubertH 2024-02-02 22:55:22 +01:00 committed by GitHub
parent 4a0b9be9b6
commit df2dbd01bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,10 @@
/* /*
* Variable voltage functions for Afterburner GAL project. * Variable voltage functions for Afterburner GAL project.
* *
* 2024-02-02 Minor changes in varVppInit()
*/ */
#ifndef __AFTB_VPP_H__
#define __AFTB_VPP_H__
#include <EEPROM.h> #include <EEPROM.h>
@ -303,11 +306,13 @@ static void varVppStoreWiperCalib() {
//return 1 on success (variable VPP functionality present), 0 on failure (VPP not detected on board) //return 1 on success (variable VPP functionality present), 0 on failure (VPP not detected on board)
static int8_t varVppInit(void) { static int8_t varVppInit(void) {
analogReference(ANALOG_REF_EXTERNAL); //use 3V3 external reference analogReference(ANALOG_REF_EXTERNAL); //use 3V3 external reference
analogRead(VPP); // Perform a dummy conversion referring to the datasheet
wiperStat = 0; //wiper disabled wiperStat = 0; //wiper disabled
mcp4131_init(); mcp4131_init();
if (mcp4131_detect()) { if (mcp4131_detect()) {
#if VPP_VERBOSE #if VPP_VERBOSE
Serial.print(mcp4151_detected ? F("MCP4151") : F("MCP4131"));
Serial.println(F(" POT found")); Serial.println(F(" POT found"));
#endif #endif
return OK; return OK;
@ -356,4 +361,4 @@ static int8_t varVppCalibrate(void) {
} }
return OK; return OK;
} }
#endif