How to change board type in a PlatformIO project?

I am new to PlatformIO but have used it now a couple of months..

So far I have worked on a single project that started out targeting an ESP-07 module and I created two environment settings for flashing via serial and via OTA.

Now I find that I need to use an ESP-07S module instead because it has 4 times the flash size (4M versus 1M). My code size is now just under half of the ESP-07's max of 1 MB and I believe that in order to use OTA you need to have space for twice the project binary in flash plus any EEPROM space you need.

So I need to change the board type to ESP-07S in yet another environment section in platformio.ini, but I have now googled in vain for a long time to find out how to do this setup change.

Can someone here direct me to where/how I can add two more env sections for ESP-07S-serialflash and ESP-07S-OTAflash?

In fact I think that my current setting is incorrect even if it has the following:

[env:esp07_serial]
platform = espressif8266@2.5.2
board = esp07
framework = arduino
lib_deps = 
	tzapu/WiFiManager@^0.16.0
	knolleary/PubSubClient@^2.8
	paulstoffregen/OneWire@^2.3.7
	milesburton/DallasTemperature@^3.11.0
	arduino-libraries/NTPClient@^3.2.1
upload_speed = 115200
upload_port = COM4
monitor_speed = 115200
monitor_port = COM4

[env:esp07_OTA]
platform = espressif8266@2.5.2
board = esp07
framework = arduino
lib_deps = 
	tzapu/WiFiManager@^0.16.0
	knolleary/PubSubClient@^2.8
	paulstoffregen/OneWire@^2.3.7
	milesburton/DallasTemperature@^3.11.0
	arduino-libraries/NTPClient@^3.2.1
upload_port = 192.168.119.234
upload_flags = --auth=default
upload_protocol = espota
monitor_speed = 115200
monitor_port = COM4

Because when I changed my physical device from Adafruit Huzzah Breakout (which uses an ESP-12 module with 4M flash) to an ESP-07 prototype it refused to do OTA even though that worked fine with the Huzzah.
Just connecting another device and not doing any code changes (or platformio.ini changes)...

So how should I correctly change the board type (or better add it as a new env setting)?

Is it as simple as copying the whole env section and give it a new name plus changing:

board = esp07
to
board = esp07s

I have not yet built the ESP-07S prototype board, need to make a new altogether because I cannot get the ESP-07 off of the board I used (a veroboard type).

If you dont get a reply in these Arduino forums, maybe ask the experts;

Apparently it is "just" a matter of adding an env setting in platformio.ini in the project root.

However there is an additional problem for me here:
The ESP-07 exists in two different flash sizes (1M and 4M) and by using board = esp07 it assumes the 4M part.
But my ESP-07 devices are all 1M parts so there is some additional tweaking needed...

After creating new env settings for esp07 and also adding this to the env section:

board_upload.maximum_size = 1048576

I built the code and tried to upload via Arduino OTA, but the upload failed with this message:

Update error: ERROR[9]: new Flash config wrong real: 1048576

But the compile show these messages:

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp07.html
PLATFORM: Espressif 8266 (2.5.2) > Espressif Generic ESP8266 ESP-07
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash

then at the end of compile:

Checking size .pio\build\esp07-serial\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=====     ]  47.9% (used 39256 bytes from 81920 bytes)
Flash: [=====     ]  45.6% (used 476516 bytes from 1044464 bytes)

I reverted to using the serial upload instead and that worked fine so the f/w is updated.

Why does ArduinoOTA fail with the message shown above when I try to update the firmware via the web browser?
I use the simplest implementationm of ArduinoOTA with no extra config added except the port number and user/password login of course.

It is not workable to have to use the serial connection to update the firmware when I have installed it in the target location...