From 0cd9ac9b35fc8eceac43b0a6b76bdde51425bc36 Mon Sep 17 00:00:00 2001 From: HubertH <51236138+hubertushirsch@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:55:22 +0100 Subject: [PATCH] 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 --- aftb_vpp.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aftb_vpp.h b/aftb_vpp.h index 4a485a8..519f4f6 100644 --- a/aftb_vpp.h +++ b/aftb_vpp.h @@ -1,7 +1,10 @@ /* * Variable voltage functions for Afterburner GAL project. * + * 2024-02-02 Minor changes in varVppInit() */ +#ifndef __AFTB_VPP_H__ +#define __AFTB_VPP_H__ #include @@ -303,12 +306,14 @@ static void varVppStoreWiperCalib() { //return 1 on success (variable VPP functionality present), 0 on failure (VPP not detected on board) static int8_t varVppInit(void) { analogReference(ANALOG_REF_EXTERNAL); //use 3V3 external reference + analogRead(VPP); // Perform a dummy conversion referring to the datasheet wiperStat = 0; //wiper disabled mcp4131_init(); if (mcp4131_detect()) { #if VPP_VERBOSE - Serial.println(F("POT found")); + Serial.print(mcp4151_detected ? F("MCP4151") : F("MCP4131")); + Serial.println(F(" POT found")); #endif return OK; } else { @@ -356,4 +361,4 @@ static int8_t varVppCalibrate(void) { } return OK; } - +#endif