; 20260416 ChatGPT
; Exercise 22_compass

[platformio]
default_envs = cy

[env]
platform = espressif32
framework = arduino
board = esp32-s3-devkitc-1
board_build.partitions = default_8MB.csv
monitor_speed = 115200
extra_scripts = pre:scripts/set_build_epoch.py
lib_deps =
  Wire
  olikraus/U8g2@^2.36.4
  lewisxhe/XPowersLib@0.3.3

build_flags =
  -I ../../shared/boards
  -I ../../external/microReticulum_Firmware
  -I ../../../../LilyGo-LoRa-Series/lib/SensorLib/src
  -D BOARD_MODEL=BOARD_TBEAM_S_V1
  -D OLED_SDA=17
  -D OLED_SCL=18
  -D OLED_ADDR=0x3C
  -D GPS_RX_PIN=9
  -D GPS_TX_PIN=8
  -D GPS_WAKEUP_PIN=7
  -D GPS_1PPS_PIN=6
  -D GPS_L76K
  -D NODE_SLOT_COUNT=7
  -D ARDUINO_USB_MODE=1
  -D ARDUINO_USB_CDC_ON_BOOT=1

  ; Declination convention:
  ;   east = positive
  ;   west = negative
  ; Manual source:
  ;   declination_manual.txt
  ;   2026-04-16  14.47° E ±0.36° changing by 0.11° W per year
  -D MAG_DECLINATION_DEG=14.47f
  -D MAG_DECLINATION_SOURCE=\"manual_noaa_web_ui\"
  -D MAG_DECLINATION_DATE=\"2026-04-16\"
  -D MAG_DECLINATION_LAT=44.93642012667761
  -D MAG_DECLINATION_LON=-123.02203699545396

[env:amy]
extends = env
build_flags =
  ${env.build_flags}
  -D BOARD_ID=\"AMY\"
  -D NODE_LABEL=\"Amy\"
  -D NODE_SHORT=\"A\"
  -D NODE_SLOT_INDEX=0
  -D LOG_AP_IP_OCTET=23
  -D GNSS_CHIP_NAME=\"L76K\"

[env:bob]
extends = env
build_flags =
  ${env.build_flags}
  -D BOARD_ID=\"BOB\"
  -D NODE_LABEL=\"Bob\"
  -D NODE_SHORT=\"B\"
  -D NODE_SLOT_INDEX=1
  -D LOG_AP_IP_OCTET=24
  -D GNSS_CHIP_NAME=\"L76K\"

[env:cy]
extends = env
build_flags =
  ${env.build_flags}
  -D BOARD_ID=\"CY\"
  -D NODE_LABEL=\"Cy\"
  -D NODE_SHORT=\"C\"
  -D NODE_SLOT_INDEX=2
  -D LOG_AP_IP_OCTET=25
  -D GNSS_CHIP_NAME=\"L76K\"
  ; defaults to "display" mode, but for this exercise we want to calibrate the compass, so we'll set the mode to "calibrate" which will display the raw magnetic heading and allow us to determine the declination experimentally.
  ;-D COMPASS_MODE=\"calibrate\"

[env:dan]
extends = env
build_flags =
  ${env.build_flags}
  -D BOARD_ID=\"DAN\"
  -D NODE_LABEL=\"Dan\"
  -D NODE_SHORT=\"D\"
  -D NODE_SLOT_INDEX=3
  -D LOG_AP_IP_OCTET=26
  -D GNSS_CHIP_NAME=\"L76K\"

[env:ed]
extends = env
build_flags =
  ${env.build_flags}
  -D BOARD_ID=\"ED\"
  -D NODE_LABEL=\"Ed\"
  -D NODE_SHORT=\"E\"
  -D NODE_SLOT_INDEX=4
  -D LOG_AP_IP_OCTET=27
  -D GNSS_CHIP_NAME=\"L76K\"

[env:flo]
extends = env
build_flags =
  ${env.build_flags}
  -D BOARD_ID=\"FLO\"
  -D NODE_LABEL=\"Flo\"
  -D NODE_SHORT=\"F\"
  -D NODE_SLOT_INDEX=5
  -D LOG_AP_IP_OCTET=28
  -D GNSS_CHIP_NAME=\"L76K\"

[env:guy]
extends = env
build_flags =
  ${env.build_flags}
  -D BOARD_ID=\"GUY\"
  -D NODE_LABEL=\"Guy\"
  -D NODE_SHORT=\"G\"
  -D NODE_SLOT_INDEX=6
  -D LOG_AP_IP_OCTET=29
  -D GNSS_CHIP_NAME=\"MAX-M10S\"
  -D GPS_UBLOX
