I replaced the macro analogInputToDigitalPin(p) in the file packages\m5stack\hardware\esp32\2.0.5\variants\m5stick_c_plus\pins_arduino.h and it seemed to work:
//#define analogInputToDigitalPin(p) (((p)<20)?(esp32_adc2gpio[(p)]):-1)
#define analogInputToDigitalPin(p) (((p)<20)?(analogChannelToDigitalPin(p)):-1)
I tested it with the following sketch, which printed the correct sequence of mappings (36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26):
#include <M5StickCPlus.h>
void setup() {
M5.begin();
M5.Lcd.fillScreen(RED);
for (uint8_t i = 0; i < 20; i++) {
Serial.println(analogInputToDigitalPin(i));
}
}
void loop() {
}
With this change, I was able to get the Blynk Quickstart example working with my M5StickCPlus, which is what led me down this rabbit hole in the first place!