Flashed with wrong flash size esp8266mod

my first esphome project so I may need some education. when I install my yaml file to the esp8266 connected to the Ultrasonic Distance Sensor it says [success] then I get the error at the bottom, ESP has been flashed with wrong flash size. the sensor is showing up in HA.
Do I have the wrong esp8266 platform in my yaml? (i have tried a few for teh esp8266mod). It does not seem to be implementing changes I make to the yaml (for example I added an additional output and changed update_interval to 1s but nothing changes.) looking for suggestions. yaml and log below.

esphome:
  name: saltlevelsensor
  friendly_name: saltlevelsensor

esp8266:
  board: d1_mini


logger:


api:
  encryption:
    key: “1234”

ota:
  password: “1234”

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password


  ap:
    ssid: "Saltlevelsensor Fallback Hotspot"
    password: “1234”


time:
  - platform: homeassistant
    id: homeassistant_time

captive_portal:


text_sensor:
  
  - platform: version
    name: salt_level_sensor ESPHome Version

  - platform: wifi_info
    ip_address:
      name: salt_level_sensor IP
    ssid:
      name: salt_level_sensor SSID
    bssid:
      name: salt_level_sensor BSSID


  
switch:
  - platform: restart
    name: "salt_level_sensor Restart"

sensor:

  - platform: uptime
    name: salt_level_sensor Uptime


  - platform: wifi_signal
    name: salt_level_sensor WiFi Signal
    update_interval: 1s

  - platform: ultrasonic
    trigger_pin: D1
    echo_pin: D2
    name: "Saltlevel in percent"
    update_interval: 1s
    filters:
    
    - lambda: return (1.02-x)*(100/1.02);
    unit_of_measurement: "%"
    
  - platform: ultrasonic
    trigger_pin: D1
    echo_pin: D2
    name: "Saltlevel in cm"
    update_interval: 1s
    filters:
    
    - lambda: return (1.02-x)*100;
    unit_of_measurement: "cm"  
    
  - platform: ultrasonic
    trigger_pin: D1
    echo_pin: D2
    name: "Sensor Distance in cm"
    update_interval: 1s
    filters:
    
    - lambda: return (x*100);
    unit_of_measurement: "cm"  
INFO ESPHome 2023.8.3
..............
Building /data/saltlevelsensor/.pioenvs/saltlevelsensor/firmware.bin
esp8266_copy_factory_bin(["/data/saltlevelsensor/.pioenvs/saltlevelsensor/firmware.bin"], ["/data/saltlevelsensor/.pioenvs/saltlevelsensor/firmware.elf"])
======================== [SUCCESS] Took 105.83 seconds ========================
INFO Successfully compiled program.
INFO Resolving IP address of saltlevelsensor.local
INFO  -> 192.168.10.165
INFO Uploading /data/saltlevelsensor/.pioenvs/saltlevelsensor/firmware.bin (516304 bytes)
INFO Compressed to 359480 bytes
ERROR Error binary size: Error: ESP has been flashed with wrong flash size. Please choose the correct 'board' option (esp01_1m always works) and then flash over USB.

Use esp01_1m. if that doesn’t work there is something wrong with your ESP. Also read this and edit your post to include pre formatted text tags for your logs and yaml.

i use esp01_1m i get this error. (thanks for the formatting link)

INFO ESPHome 2023.8.3
INFO Reading configuration /config/esphome/saltlevelsensor.yaml...
INFO Detected timezone 'America/Denver'
Failed config

sensor.ultrasonic: [source /config/esphome/saltlevelsensor.yaml:65]
  platform: ultrasonic
  
  Cannot resolve pin name 'D1' for board esp01_1m.
  trigger_pin: D1
  
  Cannot resolve pin name 'D2' for board esp01_1m.
  echo_pin: D2
  name: Saltlevel in percent
  update_interval: 1s
  filters: 
    - lambda: return (1.02-x)*(100/1.02);
  unit_of_measurement: %
sensor.ultrasonic: [source /config/esphome/saltlevelsensor.yaml:77]
  platform: ultrasonic
  
  Cannot resolve pin name 'D1' for board esp01_1m.
  trigger_pin: D1
  
  Cannot resolve pin name 'D2' for board esp01_1m.
  echo_pin: D2
  name: Saltlevel in cm
  update_interval: 1s
  filters: 
    - lambda: return (1.02-x)*100;
  unit_of_measurement: cm
sensor.ultrasonic: [source /config/esphome/saltlevelsensor.yaml:88]
  platform: ultrasonic
  
  Cannot resolve pin name 'D1' for board esp01_1m.
  trigger_pin: D1
  
  Cannot resolve pin name 'D2' for board esp01_1m.
  echo_pin: D2
  name: Sensor Distance in cm
  update_interval: 1s
  filters: 
    - lambda: return (x*100);
  unit_of_measurement: cm

Yep - if you use a generic ESP type you need to specify the GPIO numbers rather than the “friendly names”.

For instance:

D1 = GPIO05
D2 = GPIO04

Google the pinout for your particular board if these don’t work.

thanks for the input. I re-installed the updated yaml to the esp8266, via usb, with the updates you suggested, and it is working great!