The hat has 9 pins, which I have connected to the following pins on the ESP32 (first HAT then ESP):
PWR -> not connected
BUSY -> G25
RST -> G26
DC -> G27
CLK -> G15
DIN -> G13
GND -> GND
VCC -> 3.3V
The hat swichtes are set to: 4-line SPI and 0.47R (other options are 3-line SPi and 3R)
Finally fixed it.
First I connected the board to a raspberry pi with the 40 pin connector. The demo worked almost out of the box, so I knew the display wasn't at fault.
Then I went back to the ESP32
|VCC -> 3.3V|
|PWR -> 3.3V| (important, to send a "power on" signal)
|GND -> GND|
|DIN -> G13|
|CLK -> G14|
|CS -> G15|
|DC -> G27|
|RST -> G26|
|BUSY -> G25|
In the Arduino IDE I went to Sketch -> Include Library -> GxEPD2
Then File -> Examples (Scroll to bottom) -> GxEPD2 -> GxEPD2_example
In GxEPD2_Example.ino I added this line at the start of the setup function line ~172 : SPI.begin(14, -1, 13, 15);
to set my pin layout (-1 means I have no MISO pin).
Then in GxEPD2_display_selection_new_style.h:
around line 20 commented out #define GxEPD2_DISPLAY_CLASS GxEPD2_BW and included #define GxEPD2_DISPLAY_CLASS GxEPD2_3C (was right below the previous)
Also commented in this line (101): #define GxEPD2_DRIVER_CLASS GxEPD2_750c_Z08 to include the right drivers.
Lastly commented in the following line with the right pins, and commented out the wrong one in that list ~ 221-227 GxEPD2_DISPLAY_CLASS<GxEPD2_DRIVER_CLASS, MAX_HEIGHT(GxEPD2_DRIVER_CLASS)> display(GxEPD2_DRIVER_CLASS(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25)); // Waveshare ESP32 Driver Board
I'm still unsure why it didn't work before with the standard pins, but since this it's running now, I won't complain.
The Esp32 I used only had one 3.3v pin, so I had to put both pwr and vcc on the same pin.