mirror of
https://github.com/luc-github/ESP3D-Configurator.git
synced 2026-02-20 01:11:24 +01:00
Add default pins for each mcu
Add pins for SPI screens Add platformio.ini generation
This commit is contained in:
File diff suppressed because one or more lines are too long
1
images/PlatformIO_logo.svg
Normal file
1
images/PlatformIO_logo.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg width="24" height="24" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M128 0C93.81 0 61.666 13.314 37.49 37.49 13.314 61.666 0 93.81 0 128c0 34.19 13.314 66.334 37.49 90.51C61.666 242.686 93.81 256 128 256c34.19 0 66.334-13.314 90.51-37.49C242.686 194.334 256 162.19 256 128c0-34.19-13.314-66.334-37.49-90.51C194.334 13.314 162.19 0 128 0" fill="#FF7F00"/><path d="M249.386 128c0 67.04-54.347 121.386-121.386 121.386C60.96 249.386 6.613 195.04 6.613 128 6.613 60.96 60.96 6.614 128 6.614c67.04 0 121.386 54.346 121.386 121.386" fill="#FFF"/><path d="M160.869 74.062l5.145-18.537c5.264-.47 9.392-4.886 9.392-10.273 0-5.7-4.62-10.32-10.32-10.32s-10.32 4.62-10.32 10.32c0 3.755 2.013 7.03 5.01 8.837l-5.05 18.195c-14.437-3.67-26.625-3.39-26.625-3.39l-2.258 1.01v140.872l2.258.753c13.614 0 73.177-41.133 73.323-85.27 0-31.624-21.023-45.825-40.555-52.197zM146.53 164.8c-11.617-18.557-6.706-61.751 23.643-67.925 8.32-1.333 18.509 4.134 21.51 16.279 7.582 25.766-37.015 61.845-45.153 51.646zm18.216-39.752a9.399 9.399 0 0 0-9.399 9.399 9.399 9.399 0 0 0 9.4 9.399 9.399 9.399 0 0 0 9.398-9.4 9.399 9.399 0 0 0-9.399-9.398zm2.81 8.672a2.374 2.374 0 1 1 0-4.749 2.374 2.374 0 0 1 0 4.749z" fill="#E57200"/><path d="M101.371 72.709l-5.023-18.901c2.874-1.832 4.786-5.04 4.786-8.701 0-5.7-4.62-10.32-10.32-10.32-5.699 0-10.319 4.62-10.319 10.32 0 5.682 4.592 10.289 10.267 10.317L95.8 74.378c-19.609 6.51-40.885 20.742-40.885 51.88.436 45.01 59.572 85.267 73.186 85.267V68.892s-12.252-.062-26.729 3.817zm10.395 92.09c-8.138 10.2-52.735-25.88-45.154-51.645 3.002-12.145 13.19-17.612 21.511-16.28 30.35 6.175 35.26 49.369 23.643 67.926zm-18.82-39.46a9.399 9.399 0 0 0-9.399 9.398 9.399 9.399 0 0 0 9.4 9.4 9.399 9.399 0 0 0 9.398-9.4 9.399 9.399 0 0 0-9.399-9.399zm-2.81 8.671a2.374 2.374 0 1 1 0-4.748 2.374 2.374 0 0 1 0 4.748z" fill="#FF7F00"/></svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -16,4 +16,4 @@
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
import { h } from "preact"
|
||||
export const Version = "1.0.0-a4"
|
||||
export const Version = "1.0.0-a5"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
{
|
||||
"label": "1MB",
|
||||
"value": "1",
|
||||
"depend":{"id":"targetmcu","value":["esp8266"]},
|
||||
"help":"No OTA/ Web update possible"
|
||||
},
|
||||
{
|
||||
@@ -947,6 +948,66 @@
|
||||
"depend":{"id":"displaytype","value":["TFT_SPI_ST7789_135X240","TFT_SPI_ST7789_240X240"]},
|
||||
"setting":true,
|
||||
"usedescforoptions":true
|
||||
},
|
||||
{
|
||||
"id":"tftDCpin",
|
||||
"define":"DISPLAY_DC_PIN",
|
||||
"label":"TFT DC pin",
|
||||
"description":"The dc pin used for the display",
|
||||
"type":"select",
|
||||
"ispin":true,
|
||||
"value":"-1",
|
||||
"depend":{"id":"displaytype","value":["TFT_SPI_ST7789_135X240","TFT_SPI_ST7789_240X240"]},
|
||||
"setting":true,
|
||||
"usedescforoptions":true
|
||||
},
|
||||
{
|
||||
"id":"tftRSTpin",
|
||||
"define":"DISPLAY_RST_PIN",
|
||||
"label":"TFT RST pin",
|
||||
"description":"The pin used to reset display",
|
||||
"type":"select",
|
||||
"ispin":true,
|
||||
"value":"-1",
|
||||
"depend":{"id":"displaytype","value":["TFT_SPI_ST7789_135X240","TFT_SPI_ST7789_240X240"]},
|
||||
"setting":true,
|
||||
"usedescforoptions":true
|
||||
},
|
||||
{
|
||||
"id":"tftCSpin",
|
||||
"define":"DISPLAY_CS_PIN",
|
||||
"label":"TFT CS pin",
|
||||
"description":"The CS pin used by display",
|
||||
"type":"select",
|
||||
"ispin":true,
|
||||
"value":"-1",
|
||||
"depend":{"id":"displaytype","value":["TFT_SPI_ST7789_135X240","TFT_SPI_ST7789_240X240"]},
|
||||
"setting":true,
|
||||
"usedescforoptions":true
|
||||
},
|
||||
{
|
||||
"id":"tftMOSIpin",
|
||||
"define":"DISPLAY_MOSI_PIN",
|
||||
"label":"TFT MOSI pin",
|
||||
"description":"The MOSI pin used by display",
|
||||
"type":"select",
|
||||
"ispin":true,
|
||||
"value":"-1",
|
||||
"depend":{"id":"displaytype","value":["TFT_SPI_ST7789_135X240","TFT_SPI_ST7789_240X240"]},
|
||||
"setting":true,
|
||||
"usedescforoptions":true
|
||||
},
|
||||
{
|
||||
"id":"tftSCKpin",
|
||||
"define":"DISPLAY_SCK_PIN",
|
||||
"label":"TFT SCK pin",
|
||||
"description":"The SCK pin used by display",
|
||||
"type":"select",
|
||||
"ispin":true,
|
||||
"value":"-1",
|
||||
"depend":{"id":"displaytype","value":["TFT_SPI_ST7789_135X240","TFT_SPI_ST7789_240X240"]},
|
||||
"setting":true,
|
||||
"usedescforoptions":true
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
index.js - ESP3D WebUI navigation tab file
|
||||
footer.js - ESP3D-configurator footer for configuration.h file
|
||||
|
||||
Copyright (c) 2020 Luc Lebosse. All rights reserved.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
index.js - ESP3D WebUI navigation tab file
|
||||
header.js - ESP3D-configurator header for configuration.h file
|
||||
|
||||
Copyright (c) 2020 Luc Lebosse. All rights reserved.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
import { h } from "preact"
|
||||
const header =
|
||||
'\n\
|
||||
'\
|
||||
/*\n\
|
||||
configuration.h - ESP3D configuration file\n\
|
||||
\n\
|
||||
|
||||
@@ -28,9 +28,37 @@ import {
|
||||
useDatasContextFn,
|
||||
} from "../../contexts"
|
||||
import header from "./header"
|
||||
import pioheader from "./pioheader"
|
||||
import footer from "./footer"
|
||||
import piofooter from "./piofooter"
|
||||
import { Version } from "../../components/App/version"
|
||||
import { useEffect, useState } from "preact/hooks"
|
||||
const pioIcon = (
|
||||
<svg
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 256 256"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
preserveAspectRatio="xMidYMid"
|
||||
>
|
||||
<path
|
||||
d="M128 0C93.81 0 61.666 13.314 37.49 37.49 13.314 61.666 0 93.81 0 128c0 34.19 13.314 66.334 37.49 90.51C61.666 242.686 93.81 256 128 256c34.19 0 66.334-13.314 90.51-37.49C242.686 194.334 256 162.19 256 128c0-34.19-13.314-66.334-37.49-90.51C194.334 13.314 162.19 0 128 0"
|
||||
fill="#5755d9"
|
||||
/>
|
||||
<path
|
||||
d="M249.386 128c0 67.04-54.347 121.386-121.386 121.386C60.96 249.386 6.613 195.04 6.613 128 6.613 60.96 60.96 6.614 128 6.614c67.04 0 121.386 54.346 121.386 121.386"
|
||||
fill="#FFF"
|
||||
/>
|
||||
<path
|
||||
d="M160.869 74.062l5.145-18.537c5.264-.47 9.392-4.886 9.392-10.273 0-5.7-4.62-10.32-10.32-10.32s-10.32 4.62-10.32 10.32c0 3.755 2.013 7.03 5.01 8.837l-5.05 18.195c-14.437-3.67-26.625-3.39-26.625-3.39l-2.258 1.01v140.872l2.258.753c13.614 0 73.177-41.133 73.323-85.27 0-31.624-21.023-45.825-40.555-52.197zM146.53 164.8c-11.617-18.557-6.706-61.751 23.643-67.925 8.32-1.333 18.509 4.134 21.51 16.279 7.582 25.766-37.015 61.845-45.153 51.646zm18.216-39.752a9.399 9.399 0 0 0-9.399 9.399 9.399 9.399 0 0 0 9.4 9.399 9.399 9.399 0 0 0 9.398-9.4 9.399 9.399 0 0 0-9.399-9.398zm2.81 8.672a2.374 2.374 0 1 1 0-4.749 2.374 2.374 0 0 1 0 4.749z"
|
||||
fill="#5755d9"
|
||||
/>
|
||||
<path
|
||||
d="M101.371 72.709l-5.023-18.901c2.874-1.832 4.786-5.04 4.786-8.701 0-5.7-4.62-10.32-10.32-10.32-5.699 0-10.319 4.62-10.319 10.32 0 5.682 4.592 10.289 10.267 10.317L95.8 74.378c-19.609 6.51-40.885 20.742-40.885 51.88.436 45.01 59.572 85.267 73.186 85.267V68.892s-12.252-.062-26.729 3.817zm10.395 92.09c-8.138 10.2-52.735-25.88-45.154-51.645 3.002-12.145 13.19-17.612 21.511-16.28 30.35 6.175 35.26 49.369 23.643 67.926zm-18.82-39.46a9.399 9.399 0 0 0-9.399 9.398 9.399 9.399 0 0 0 9.4 9.4 9.399 9.399 0 0 0 9.398-9.4 9.399 9.399 0 0 0-9.399-9.399zm-2.81 8.671a2.374 2.374 0 1 1 0-4.748 2.374 2.374 0 0 1 0 4.748z"
|
||||
fill="#5755d9"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
|
||||
const configurationFile = (data) => {
|
||||
return (
|
||||
@@ -41,6 +69,341 @@ const configurationFile = (data) => {
|
||||
)
|
||||
}
|
||||
|
||||
const pioFile = () => {
|
||||
return (
|
||||
`;This file was generated by ESP3D-Configurator V${Version} \n` +
|
||||
pioheader +
|
||||
convertPioToText() +
|
||||
piofooter
|
||||
)
|
||||
}
|
||||
|
||||
const sections = {
|
||||
esp32: {
|
||||
common:
|
||||
"platform = espressif32@4.4.0\n" +
|
||||
"board = esp32dev\n" +
|
||||
"framework = arduino\n" +
|
||||
"monitor_speed = 115200\n" +
|
||||
"monitor_flags = --echo\n" +
|
||||
"monitor_filters = send_on_enter, colorize, esp32_exception_decoder\n" +
|
||||
"; set frequency to 240MHz\n" +
|
||||
";board_build.f_cpu = 240000000L\n" +
|
||||
"; set frequency to 80MHz\n" +
|
||||
";board_build.f_flash = 80000000L\n" +
|
||||
";board_build.flash_mode = qio\n" +
|
||||
"upload_speed = 460800\n" +
|
||||
"extra_scripts = pre:platformIO/extra_script.py\n",
|
||||
build_flags: " -DCORE_DEBUG_LEVEL=0\n",
|
||||
defaultMosi: 23,
|
||||
defaultSck: 18,
|
||||
defaultCs: 5,
|
||||
defaultMiso: 19,
|
||||
defaultSda: 21,
|
||||
defaultScl: 22,
|
||||
},
|
||||
esp32s2: {
|
||||
common:
|
||||
"platform = espressif32@4.4.0\n" +
|
||||
"board = esp32-s2-saola-1\n" +
|
||||
"framework = arduino\n" +
|
||||
"board_build.mcu = esp32s2\n" +
|
||||
"board_build.variant = esp32s2\n" +
|
||||
"monitor_speed = 115200\n" +
|
||||
"monitor_flags = --echo\n" +
|
||||
"monitor_filters = send_on_enter, colorize, esp32_exception_decoder\n" +
|
||||
"set frequency to 240MHz\n" +
|
||||
"board_build.f_cpu = 240000000L\n" +
|
||||
"set frequency to 80MHz\n" +
|
||||
"board_build.f_flash = 80000000L\n" +
|
||||
"board_build.flash_mode = qio\n" +
|
||||
"upload_speed = 460800\n" +
|
||||
"extra_scripts = pre:platformIO/extra_script.py\n",
|
||||
build_flags:
|
||||
" -DCORE_DEBUG_LEVEL=0\n-DARDUINO_USB_CDC_ON_BOOT=0\n-DARDUINO_USB_MSC_ON_BOOT=0\n-DARDUINO_USB_DFU_ON_BOOT=0\n-DCONFIG_IDF_TARGET_ESP32S2=1\n",
|
||||
lib_ignore: "TFT_eSPI\n",
|
||||
defaultMosi: 35,
|
||||
defaultSck: 36,
|
||||
defaultCs: 34,
|
||||
defaultMiso: 37,
|
||||
defaultSda: 8,
|
||||
defaultScl: 9,
|
||||
},
|
||||
esp32s3: {
|
||||
common:
|
||||
"platform = espressif32@4.4.0\n" +
|
||||
"board = esp32-s3-devkitc-1\n" +
|
||||
"framework = arduino\n" +
|
||||
"board_build.mcu = esp32s3\n" +
|
||||
"board_build.variant = esp32s3\n" +
|
||||
"monitor_speed = 115200\n" +
|
||||
"monitor_flags = --echo\n" +
|
||||
"monitor_filters = send_on_enter, colorize, esp32_exception_decoder\n" +
|
||||
"set frequency to 240MHz\n" +
|
||||
"board_build.f_cpu = 240000000L\n" +
|
||||
"set frequency to 80MHz\n" +
|
||||
"board_build.f_flash = 80000000L\n" +
|
||||
"board_build.flash_mode = qio\n" +
|
||||
"upload_speed = 460800\n" +
|
||||
"extra_scripts = pre:platformIO/extra_script.py\n",
|
||||
build_flags:
|
||||
" -DCORE_DEBUG_LEVEL=0\n-DARDUINO_USB_CDC_ON_BOOT=0\n-DARDUINO_USB_MSC_ON_BOOT=0\n-DARDUINO_USB_DFU_ON_BOOT=0\n-DCONFIG_IDF_TARGET_ESP32S3=1\n",
|
||||
lib_ignore: "TFT_eSPI\n",
|
||||
defaultMosi: 11,
|
||||
defaultSck: 12,
|
||||
defaultCs: 10,
|
||||
defaultMiso: 13,
|
||||
defaultSda: 8,
|
||||
defaultScl: 9,
|
||||
},
|
||||
esp32c3: {
|
||||
common:
|
||||
"platform = espressif32@4.4.0\n" +
|
||||
"board = esp32-c3-devkitm-1\n" +
|
||||
"framework = arduino\n" +
|
||||
"board_build.mcu = esp32c3\n" +
|
||||
"board_build.variant = esp32c3\n" +
|
||||
"monitor_speed = 115200\n" +
|
||||
"monitor_flags = --echo\n" +
|
||||
"monitor_filters = send_on_enter, colorize, esp32_exception_decoder\n" +
|
||||
"set frequency to 240MHz\n" +
|
||||
"board_build.f_cpu = 240000000L\n" +
|
||||
"set frequency to 80MHz\n" +
|
||||
"board_build.f_flash = 80000000L\n" +
|
||||
"board_build.flash_mode = qio\n" +
|
||||
"upload_speed = 460800\n" +
|
||||
"extra_scripts = pre:platformIO/extra_script.py\n",
|
||||
build_flags: " -DCORE_DEBUG_LEVEL=0\n-DCONFIG_IDF_TARGET_ESP32C3=1\n",
|
||||
lib_ignore: "TFT_eSPI\n",
|
||||
defaultMosi: 6,
|
||||
defaultSck: 4,
|
||||
defaultCs: 7,
|
||||
defaultMiso: 5,
|
||||
defaultSda: 8,
|
||||
defaultScl: 9,
|
||||
},
|
||||
esp8266: {
|
||||
common:
|
||||
"platform = https://github.com/platformio/platform-espressif8266.git\n" +
|
||||
"board = esp12e\n" +
|
||||
"framework = arduino\n" +
|
||||
"monitor_speed = 115200\n" +
|
||||
"monitor_flags = --echo\n" +
|
||||
"monitor_filters = send_on_enter, colorize, esp8266_exception_decoder\n" +
|
||||
"; set frequency to 160MHz\n" +
|
||||
"board_build.f_cpu = 160000000L\n" +
|
||||
"; set frequency to 40MHz\n" +
|
||||
"board_build.f_flash = 40000000L\n" +
|
||||
"board_build.flash_mode = dout\n" +
|
||||
"upload_resetmethod = nodemcu\n" +
|
||||
"upload_speed = 115200\n" +
|
||||
"extra_scripts = pre:platformIO/extra_script.py\n",
|
||||
build_flags:
|
||||
" -D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY\n-DNONOSDK221=1\n-DNDEBUG -DVTABLES_IN_FLASH\n-DWAVEFORM_LOCKED_PWM\n",
|
||||
lib_ignore: "ESP32SSPD\n",
|
||||
defaultMosi: 13,
|
||||
defaultSck: 14,
|
||||
defaultCs: 15,
|
||||
defaultMiso: 12,
|
||||
defaultSda: 4,
|
||||
defaultScl: 5,
|
||||
},
|
||||
}
|
||||
|
||||
const libIgnore = ({
|
||||
target,
|
||||
targetsize,
|
||||
hasWifi,
|
||||
hasEthernet,
|
||||
hasBT,
|
||||
cameraName,
|
||||
displayName,
|
||||
envName,
|
||||
}) => {
|
||||
return sections[target].lib_ignore
|
||||
? "lib_ignore = " + sections[target].lib_ignore + "\n"
|
||||
: ""
|
||||
}
|
||||
|
||||
const cameraBuildFlags = (target, cameraName) => {
|
||||
if (cameraName != "-1") {
|
||||
return ` -DBOARD_HAS_PSRAM\n${
|
||||
target == "esp32" ? " -mfix-esp32-psram-cache-issue\n" : ""
|
||||
}`
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
const displayBuildFlags = (target, displayName) => {
|
||||
if (
|
||||
displayName == "TFT_SPI_ST7789_240X240" ||
|
||||
displayName == "TFT_SPI_ST7789_135X240"
|
||||
) {
|
||||
const width = displayName == "TFT_SPI_ST7789_135X240" ? 135 : 240
|
||||
const height = 240
|
||||
const rstpin = useDatasContextFn.getValueId("tftRSTpin")
|
||||
const dcpin = useDatasContextFn.getValueId("tftDCpin")
|
||||
const cspin = useDatasContextFn.getValueId("tftCSpin")
|
||||
const mosipin = useDatasContextFn.getValueId("tftMOSIpin")
|
||||
const sckpin = useDatasContextFn.getValueId("tftSCKpin")
|
||||
|
||||
const backlightpin = useDatasContextFn.getValueId("tftledpin")
|
||||
const defaultMosi = sections[target].defaultMosi
|
||||
const defaultSck = sections[target].defaultSck
|
||||
const defaultCs = sections[target].defaultCs
|
||||
return (
|
||||
" -Os\n" +
|
||||
"-DUSER_SETUP_LOADED=1\n" +
|
||||
"-DST7789_DRIVER=1\n" +
|
||||
"-DTFT_SDA_READY=1\n" +
|
||||
"-DCGRAM_OFFSET=1\n" +
|
||||
`-DTFT_WIDTH=${width}\n` +
|
||||
`-DTFT_HEIGHT=${height}\n` +
|
||||
`-DTFT_MOSI=${mosipin == "-1" ? defaultMosi : mosipin}\n` +
|
||||
`-DTFT_SCLK=${sckpin == "-1" ? defaultSck : sckpin}\n` +
|
||||
`-DTFT_CS=${cspin == "-1" ? defaultCs : cspin}\n` +
|
||||
`-DTFT_DC=${dcpin}\n` +
|
||||
`-DTFT_RST=${rstpin}\n` +
|
||||
`-DTFT_BL=${backlightpin}\n` +
|
||||
`-DTFT_BACKLIGHT_ON=${backlightpin == "-1" ? 0 : 1}\n` +
|
||||
"-DLOAD_GLCD=1\n" +
|
||||
"-DLOAD_FONT2=1\n" +
|
||||
"-DLOAD_FONT4=1\n" +
|
||||
"-DLOAD_FONT6=1\n" +
|
||||
"-DLOAD_FONT7=1\n" +
|
||||
"-DLOAD_FONT8=1\n" +
|
||||
"-DLOAD_GFXFF=1\n" +
|
||||
"-DSMOOTH_FONT=1\n" +
|
||||
"-DSPI_FREQUENCY=40000000\n" +
|
||||
"-DSPI_READ_FREQUENCY=6000000"
|
||||
)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
const buildFlags = ({
|
||||
target,
|
||||
targetsize,
|
||||
hasWifi,
|
||||
hasEthernet,
|
||||
hasBT,
|
||||
cameraName,
|
||||
displayName,
|
||||
}) => {
|
||||
//todo add Cam
|
||||
return (
|
||||
"build_flags = " +
|
||||
sections[target].build_flags +
|
||||
displayBuildFlags(target, displayName) +
|
||||
cameraBuildFlags(target, cameraName)
|
||||
)
|
||||
}
|
||||
|
||||
const partitionScheme = (target, targetsize, hasWifi, hasEthernet, hasBT) => {
|
||||
if (target === "esp8266") {
|
||||
switch (targetsize) {
|
||||
case "1":
|
||||
return "board_build.ldscript = eagle.flash.1m256.ld\n"
|
||||
case "2":
|
||||
return "board_build.ldscript = eagle.flash.2m256.ld\n"
|
||||
case "4":
|
||||
return "board_build.ldscript = eagle.flash.4m2m.ld\n"
|
||||
case "8":
|
||||
return "board_build.ldscript = eagle.flash.8m6m.ld\n"
|
||||
case "16":
|
||||
return "board_build.ldscript = eagle.flash.16m14m.ld\n"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
} else {
|
||||
switch (targetsize) {
|
||||
case "2":
|
||||
return "board_upload.flash_size = 4MB\nboard_build.partitions = minimal.csv"
|
||||
case "4":
|
||||
if ((hasWifi || hasEthernet) && hasBT) {
|
||||
return "board_upload.flash_size = 4MB\nboard_build.partitions = min_spiffs.csv\n"
|
||||
}
|
||||
return "board_upload.flash_size = 4MB\nboard_build.partitions = default.csv\n"
|
||||
case "8":
|
||||
return "board_upload.flash_size = 8MB\nboard_build.partitions = default_8MB.csv\n"
|
||||
case "16":
|
||||
return "board_upload.flash_size = 16MB\nboard_build.partitions = large_spiffs_16MB.csv\n"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const convertToPioEnv = ({
|
||||
target,
|
||||
targetsize,
|
||||
hasWifi,
|
||||
hasEthernet,
|
||||
hasBT,
|
||||
cameraName,
|
||||
displayName,
|
||||
envName,
|
||||
}) => {
|
||||
/*
|
||||
"build_flags":"build_flags = -DCORE_DEBUG_LEVEL=0\n",
|
||||
|
||||
*/
|
||||
return (
|
||||
"[" +
|
||||
envName +
|
||||
"]\n" +
|
||||
sections[target].common +
|
||||
partitionScheme(target, targetsize, hasWifi, hasEthernet, hasBT) +
|
||||
libIgnore({
|
||||
target,
|
||||
targetsize,
|
||||
hasWifi,
|
||||
hasEthernet,
|
||||
hasBT,
|
||||
cameraName,
|
||||
displayName,
|
||||
}) +
|
||||
buildFlags({
|
||||
target,
|
||||
targetsize,
|
||||
hasWifi,
|
||||
hasEthernet,
|
||||
hasBT,
|
||||
cameraName,
|
||||
displayName,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
const convertPioToText = () => {
|
||||
const target = useDatasContextFn.getValueId("targetmcu")
|
||||
const targetsize = useDatasContextFn.getValueId("targetflashsize")
|
||||
const hasWifi = useDatasContextFn.getValueId("wifi")
|
||||
const hasEthernet = useDatasContextFn.getValueId("ethernet")
|
||||
const hasBT = useDatasContextFn.getValueId("bluetooth")
|
||||
const cameraName = useDatasContextFn.getValueId("cameratype")
|
||||
const displayName = useDatasContextFn.getValueId("displaytype")
|
||||
let res = ""
|
||||
const envName = `${target}_${targetsize}MB${
|
||||
cameraName == "-1" ? "" : "_cam"
|
||||
}${displayName == "-1" ? "" : "_disp"}${hasWifi ? "_wifi" : ""}${
|
||||
hasEthernet ? "_eth" : ""
|
||||
}${hasBT ? "_bt" : ""}`
|
||||
return (
|
||||
`default_envs = ${envName}\n\n` +
|
||||
convertToPioEnv({
|
||||
target,
|
||||
targetsize,
|
||||
hasWifi,
|
||||
hasEthernet,
|
||||
hasBT,
|
||||
cameraName,
|
||||
displayName,
|
||||
envName,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
const sectionFormated = (title, description) => {
|
||||
return `\n/************************************\n*\n* ${title}\n*\n* ${description}\n*\n************************************/\n`
|
||||
}
|
||||
@@ -83,7 +446,7 @@ const canshow = (depend, pinvalue, currentvalue) => {
|
||||
}
|
||||
|
||||
const convertToText = (data) => {
|
||||
console.log(data)
|
||||
//console.log(data)
|
||||
let config = ""
|
||||
return Object.keys(data).reduce((acc, item) => {
|
||||
return data[item].reduce((acc2, item2) => {
|
||||
@@ -200,6 +563,7 @@ const exportFile = (filecontent, filename) => {
|
||||
}
|
||||
|
||||
let showconfig = false
|
||||
let showini = false
|
||||
|
||||
const NavButtons = ({ previous, next }) => {
|
||||
const { configuration } = useDatasContext()
|
||||
@@ -228,6 +592,14 @@ const NavButtons = ({ previous, next }) => {
|
||||
)
|
||||
}}
|
||||
/>
|
||||
<ButtonImg
|
||||
m2
|
||||
icon={pioIcon}
|
||||
label={T("Download platformio.ini")}
|
||||
onclick={() => {
|
||||
exportFile(pioFile(), "platformio.ini")
|
||||
}}
|
||||
/>
|
||||
<ButtonImg
|
||||
m2
|
||||
icon={<Eye />}
|
||||
@@ -269,6 +641,7 @@ const NavButtons = ({ previous, next }) => {
|
||||
const GenerateTab = ({ previous }) => {
|
||||
const { configuration } = useDatasContext()
|
||||
const [showContent, setshowContent] = useState(showconfig)
|
||||
const [showIniContent, setshowIniContent] = useState(showini)
|
||||
return (
|
||||
<div id="generate" class="m-2">
|
||||
<NavButtons previous={previous} />
|
||||
@@ -303,6 +676,40 @@ const GenerateTab = ({ previous }) => {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div class="accordion">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="accordion-2"
|
||||
name="accordion-checkbox"
|
||||
hidden
|
||||
/>
|
||||
<label
|
||||
class="accordion-header"
|
||||
for="accordion-2"
|
||||
style="cursor:pointer"
|
||||
onclick={() => {
|
||||
showini = !showini
|
||||
setshowIniContent(showini)
|
||||
}}
|
||||
>
|
||||
{!showIniContent && (
|
||||
<i class="icon icon-arrow-right mr-1"></i>
|
||||
)}
|
||||
{showIniContent && (
|
||||
<i class="icon icon-arrow-down mr-1"></i>
|
||||
)}
|
||||
platformIO.h
|
||||
</label>
|
||||
{showIniContent && (
|
||||
<div class="accordion-body">
|
||||
<code>
|
||||
<pre>{pioFile()}</pre>
|
||||
</code>
|
||||
</div>
|
||||
)}
|
||||
<div class="m-2" />
|
||||
</div>
|
||||
|
||||
{showContent && <NavButtons previous={previous} />}
|
||||
<br />
|
||||
</div>
|
||||
|
||||
23
src/tabs/generate/piofooter.js
Normal file
23
src/tabs/generate/piofooter.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
piofooter.js - ESP3D-configurator footer for configuration.h file
|
||||
|
||||
Copyright (c) 2020 Luc Lebosse. All rights reserved.
|
||||
|
||||
This code is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with This code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
import { h } from "preact"
|
||||
const piofooter = "\n\
|
||||
"
|
||||
export default piofooter
|
||||
40
src/tabs/generate/pioheader.js
Normal file
40
src/tabs/generate/pioheader.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
pioheader.js - ESP3D-configurator header for configuration.h file
|
||||
|
||||
Copyright (c) 2020 Luc Lebosse. All rights reserved.
|
||||
|
||||
This code is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with This code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
import { h } from "preact"
|
||||
const pioheader =
|
||||
"\
|
||||
; PlatformIO Project Configuration File\n\
|
||||
;\n\
|
||||
; Build options: build flags, source filter\n\
|
||||
; Upload options: custom upload port, speed and extra flags\n\
|
||||
; Library options: dependencies, extra library storages\n\
|
||||
; Advanced options: extra scripting\n\
|
||||
;\n\
|
||||
; Please visit documentation for the other options and examples\n\
|
||||
; https://docs.platformio.org/page/projectconf.html\n\
|
||||
\n\
|
||||
[platformio]\n\
|
||||
src_dir = esp3d\n\
|
||||
build_dir = .pioenvs\n\
|
||||
lib_dir = libraries\n\
|
||||
libdeps_dir = .piolibdeps\n\
|
||||
data_dir = esp3d/data\n\
|
||||
"
|
||||
export default pioheader
|
||||
Reference in New Issue
Block a user