gepd / Deviot

Sublime Text plugin for IoT development based in PlatformIO ecosystem (Arduino IDE)
Apache License 2.0
307 stars 55 forks source link

DEV BUG corrupt platformio.ini on readconfig write #272

Open tablatronix opened 5 years ago

tablatronix commented 5 years ago

if you have a comment in your platformio.ini upload speed overwrite gets corrupt ( newline added )

platformio.exception.InvalidProjectConf: Invalid `platformio.ini`, project configuration file: 'File contains parsing errors: /Users/.../projects/microcontrollers/dev/build/OnDemandConfigPortal/platformio.ini
    [line 35]: '/Users/.../projects/microcontrollers/dev/libraries\n''
[env:nodemcuv2_dev]
platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
board = nodemcuv2
framework = arduino
upload_speed = 
921600
; build_flags =-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -Wall -Wextra
tablatronix commented 5 years ago

hmm this might only occur is ota and upload_flags = --auth=1234 is present in the file.. odd

gepd commented 5 years ago

I've updated to dev9 https://github.com/gepd/Deviot/commit/5f6e399cc88c5e2bb4e3b3d5194f13b0455a3256 should solve this problem.

If this isn't can you give a detailed example to reproduce the problem?

tablatronix commented 5 years ago

Ill test bit see the build line above I have ; commented out, when deviot touches the file it puts a newline as above

tablatronix commented 4 years ago

Deviot completely corrupts platformio.ini files No idea what it is doing seems to remove comments and messes up newlines.

Every-time you try to compile so there is no way around it failing.

Screen Shot 2020-03-18 at 12 03 39 PM (2)

tablatronix commented 4 years ago

311

tablatronix commented 4 years ago

Let me see if I am indeed using this branch (dev9), will post back!

tablatronix commented 4 years ago

[ Deviot 2.3.0.dev12 ] Starting...

So it is something else and this did not fix it.

tablatronix commented 4 years ago

lol well i was trying to create reproduction steps but I cannot install new libraries, ugh rate limited somehow...

Exception in thread Thread-45:
Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "./python3.3/threading.py", line 858, in run
  File "/Users/shawn/Library/Application Support/Sublime Text 3/Packages/Deviot (Arduino IDE)/libraries/libraries.py", line 99, in download_list
    response = urlopen(req)
  File "./python3.3/urllib/request.py", line 156, in urlopen
  File "./python3.3/urllib/request.py", line 475, in open
  File "./python3.3/urllib/request.py", line 587, in http_response
  File "./python3.3/urllib/request.py", line 513, in error
  File "./python3.3/urllib/request.py", line 447, in _call_chain
  File "./python3.3/urllib/request.py", line 595, in http_error_default
urllib.error.HTTPError: HTTP Error 429: Too Many Requests

Let me wait and see if it resets soon...

tablatronix commented 4 years ago

Ok ( had to install manually )

[Sun Jul 12 11:16:52 2020]



- Diff platformio.ini and see the bad newlines etc.
tablatronix commented 4 years ago

Comment counting eval handling is wrong

init.py readconfig write()

                        if(len(comcount) == 0):
                            values = '\n' + values ; <-- NEWLINES after platform = 

This seems wrong, If I remove the \n it works

tablatronix commented 4 years ago

This is the diff of corrupt files, when a new line gets inserted wrong, You can see there are a few things that get removed also, but the main issue is the newlines on values.

--- /Users/shawn/projects/microcontrollers/dev/libraries/WLED/platformio.ini
+++ (clipboard)
@@ -2,25 +2,20 @@
 ; Please visit documentation: https://docs.platformio.org/page/projectconf.html

 [platformio]
-src_dir  = ./wled00
+src_dir = ./wled00
 data_dir = ./wled00/data
-lib_dir  = ./wled00/src
+lib_dir = ./wled00/src
 build_cache_dir = ~/.buildcache
-extra_configs = 
-  platformio_override.ini
-
+extra_configs =   platformio_override.ini
 # ------------------------------------------------------------------------------
 # ENVIRONMENTS
 #
 # Please uncomment one of the lines below to select your board(s)
 # ------------------------------------------------------------------------------
-
 # Travis CI binaries
 default_envs = travis_esp8266, esp01, esp01_1m_ota, travis_esp32
-
 # Release binaries
 ; default_envs = nodemcuv2, esp01, esp01_1m_ota, esp01_1m_full, esp32dev, custom_WS2801, custom_APA102, custom_LEDPIN_16, custom_LEDPIN_4, custom32_LEDPIN_16
-
 # Single binaries (uncomment your board)
 ; default_envs = nodemcuv2
 ; default_envs = esp01
@@ -40,23 +35,11 @@
 ; default_envs = wemos_shield_esp32
 ; default_envs = m5atom

+
+
+
+
 [common]
-# ------------------------------------------------------------------------------
-# PLATFORM:
-#   !! DO NOT confuse platformio's ESP8266 development platform with Arduino core for ESP8266
-#
-#   arduino core 2.3.0 = platformIO 1.5.0
-#   arduino core 2.4.0 = platformIO 1.6.0
-#   arduino core 2.4.1 = platformIO 1.7.3
-#   arduino core 2.4.2 = platformIO 1.8.0
-#   arduino core 2.5.0 = platformIO 2.0.4
-#   arduino core 2.5.1 = platformIO 2.1.1
-#   arduino core 2.5.2 = platformIO 2.2.3
-#   arduino core 2.6.1 = platformIO 2.3.0
-#   arduino core 2.6.2 = platformIO 2.3.1
-#   arduino core 2.6.3 = platformIO 2.3.2
-#   arduino core 2.7.0 = platformIO 2.5.0
-# ------------------------------------------------------------------------------
 arduino_core_2_3_0 = espressif8266@1.5.0
 arduino_core_2_4_0 = espressif8266@1.6.0
 arduino_core_2_4_1 = espressif8266@1.7.3
@@ -68,24 +51,20 @@
 arduino_core_2_6_2 = espressif8266@2.3.1
 arduino_core_2_6_3 = espressif8266@2.3.3
 arduino_core_2_7_1 = espressif8266@2.5.1
-
 # Development platforms
 arduino_core_develop = https://github.com/platformio/platform-espressif8266#develop
 arduino_core_git = https://github.com/platformio/platform-espressif8266#feature/stage
-
 # Platform to use for ESP8266
 platform_wled_default = ${common.arduino_core_2_7_1}
 # We use 2.7.0+ on analog boards because of PWM flicker fix
 platform_latest = ${common.arduino_core_2_7_1}
-
 # ------------------------------------------------------------------------------
 # FLAGS: DEBUG
 #
 # ------------------------------------------------------------------------------
 debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_TLS_MEM
 #if needed (for memleaks etc) also add; -DDEBUG_ESP_OOM -include "umm_malloc/umm_malloc_cfg.h"
-#-DDEBUG_ESP_CORE is not working right now 
-
+#-DDEBUG_ESP_CORE is not working right now
 # ------------------------------------------------------------------------------
 # FLAGS: ldscript
 #    ldscript_512k ( 512 KB) =  487 KB sketch, 4 KB eeprom,      no spiffs, 16 KB reserved
@@ -110,19 +89,18 @@
 #     TLS_RSA_WITH_AES_256_CBC_SHA / AES256-SHA
 #  This reduces the OTA size with ~45KB, so it's especially useful on low memory boards (512k/1m).
 # ------------------------------------------------------------------------------
-build_flags = -g -w -DMQTT_MAX_PACKET_SIZE=1024 -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH 
+build_flags =
+-g -w -DMQTT_MAX_PACKET_SIZE=1024 -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
   -DSECURE_CLIENT=SECURE_CLIENT_BEARSSL -DBEARSSL_SSL_BASIC
   #build_flags for the IRremoteESP8266 library (enabled decoders have to appear here)
-  -D _IR_ENABLE_DEFAULT_=false 
-  -D DECODE_HASH=true 
+  -D _IR_ENABLE_DEFAULT_=false
+  -D DECODE_HASH=true
   -D DECODE_NEC=true
-  -D DECODE_SONY=true 
+  -D DECODE_SONY=true
   -D DECODE_SAMSUNG=true
   -D DECODE_LG=true
-  
 build_flags_esp8266 = ${common.build_flags} -DESP8266
-build_flags_esp32   = ${common.build_flags} -DARDUINO_ARCH_ESP32
-
+build_flags_esp32 = ${common.build_flags} -DARDUINO_ARCH_ESP32
 # enables all features for travis CI
 build_flags_all_features =
   -D WLED_USE_ANALOG_LED
@@ -131,26 +109,31 @@
   -D WLED_ENABLE_ADALIGHT
   -D WLED_ENABLE_DMX
   -D WLED_ENABLE_MQTT
-
-ldscript_512k = eagle.flash.512k.ld   ;for older versions change this to eagle.flash.512k0.ld 
-ldscript_1m0m = eagle.flash.1m.ld     ;for older versions change this to eagle.flash.1m0.ld 
+ldscript_512k = eagle.flash.512k.ld   ;for older versions change this to eagle.flash.512k0.ld
+ldscript_1m0m = eagle.flash.1m.ld     ;for older versions change this to eagle.flash.1m0.ld
 ldscript_2m1m = eagle.flash.2m1m.ld
 ldscript_4m1m = eagle.flash.4m1m.ld
 ldscript_4m3m = eagle.flash.4m3m.ld
-
 shared_libdeps_dir = ./wled00/src
-
 # ------------------------------------------------------------------------------
 # COMMON SETTINGS:
 # ------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
 [env]
-framework = arduino
+framework =
+arduino
 board_build.flash_mode = dout
 monitor_speed = 115200
 upload_speed = 115200
 lib_extra_dirs =
     ${common.shared_libdeps_dir}
-
 # ------------------------------------------------------------------------------
 # LIBRARIES: required dependencies
 #   Please note that we don't always use the latest version of a library.
@@ -167,7 +150,7 @@
     AsyncTCP@1.0.3
     https://github.com/Aircoookie/ESPAsyncWebServer
     IRremoteESP8266@2.7.3
-  #For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line  
+  #For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
     #TFT_eSPI
   #For use SSD1306 OLED display uncomment following
     #U8g2@~2.27.2
@@ -177,101 +160,118 @@
     #BME280@~3.0.0
 lib_ignore =
     AsyncTCP
-
 # ------------------------------------------------------------------------------
 # WLED BUILDS
 # ------------------------------------------------------------------------------
+
+

 [env:nodemcuv2]
 board = nodemcuv2
-platform = ${common.platform_wled_default}
-board_build.ldscript = ${common.ldscript_4m1m}
-build_flags = ${common.build_flags_esp8266}
+platform =
+${common.platform_wled_default}
+board_build.ldscript = ${common.ldscript_4m1m}
+build_flags = ${common.build_flags_esp8266}
+lib_extra_dirs = /Users/shawn/projects/microcontrollers/dev/libraries

 [env:esp01]
 board = esp01
-platform = ${common.platform_wled_default}
+platform =
+${common.platform_wled_default}
 board_build.ldscript = ${common.ldscript_512k}
-build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA -D WLED_DISABLE_ALEXA -D WLED_DISABLE_BLYNK 
+build_flags =
+${common.build_flags_esp8266} -D WLED_DISABLE_OTA -D WLED_DISABLE_ALEXA -D WLED_DISABLE_BLYNK
    -D WLED_DISABLE_CRONIXIE -D WLED_DISABLE_HUESYNC -D WLED_DISABLE_INFRARED -D WLED_DISABLE_MQTT

 [env:esp01_1m_ota]
 board = esp01_1m
-platform = ${common.platform_wled_default}
+platform =
+${common.platform_wled_default}
 board_build.ldscript = ${common.ldscript_1m0m}
 build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABLE_BLYNK -D WLED_DISABLE_CRONIXIE -D WLED_DISABLE_HUESYNC -D WLED_DISABLE_INFRARED -D WLED_DISABLE_MQTT

 [env:esp01_1m_full]
 board = esp01_1m
-platform = ${common.platform_wled_default}
+platform =
+${common.platform_wled_default}
 board_build.ldscript = ${common.ldscript_1m0m}
 build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA

 [env:esp07]
 board = esp07
+platform =
+${common.platform_wled_default}
+board_build.ldscript = ${common.ldscript_4m1m}
+build_flags = ${common.build_flags_esp8266}
+
+[env:d1_mini]
+board = d1_mini
 platform = ${common.platform_wled_default}
-board_build.ldscript = ${common.ldscript_4m1m}
-build_flags = ${common.build_flags_esp8266} 
-
-[env:d1_mini]
-board = d1_mini
-platform = ${common.platform_wled_default}
-upload_speed = 921600
-board_build.ldscript = ${common.ldscript_4m1m}
-build_flags = ${common.build_flags_esp8266} 
+upload_speed =
+921600
+board_build.ldscript = ${common.ldscript_4m1m}
+build_flags = ${common.build_flags_esp8266}

 [env:heltec_wifi_kit_8]
 board = d1_mini
-platform = ${common.platform_wled_default}
+platform =
+${common.platform_wled_default}
 board_build.ldscript = ${common.ldscript_4m1m}
 build_flags = ${common.build_flags_esp8266}

 [env:h803wf]
 board = d1_mini
-platform = ${common.platform_wled_default}
+platform =
+${common.platform_wled_default}
 board_build.ldscript = ${common.ldscript_4m1m}
 build_flags = ${common.build_flags_esp8266} -D LEDPIN=1 -D WLED_DISABLE_INFRARED

 [env:esp32dev]
 board = esp32dev
 platform = espressif32@1.11.2
-build_flags = ${common.build_flags_esp32} 
+build_flags =
+${common.build_flags_esp32}
 lib_ignore =
   ESPAsyncTCP
   ESPAsyncUDP

 [env:esp8285_4CH_MagicHome]
 board = esp8285
-platform = ${common.platform_latest}
+platform =
+${common.platform_latest}
 board_build.ldscript = ${common.ldscript_1m0m}
 build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_HUESYNC -D WLED_USE_ANALOG_LEDS

 [env:esp8285_4CH_H801]
 board = esp8285
-platform = ${common.platform_latest}
+platform =
+${common.platform_latest}
 board_build.ldscript = ${common.ldscript_1m0m}
 build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_HUESYNC -D WLED_USE_ANALOG_LEDS -D WLED_USE_H801

 [env:esp8285_5CH_H801]
 board = esp8285
-platform = ${common.platform_latest}
-board_build.ldscript = ${common.ldscript_1m0m}
-build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_HUESYNC -D WLED_USE_ANALOG_LEDS -D WLED_USE_H801 -D WLED_ENABLE_5CH_LEDS 
+platform =
+${common.platform_latest}
+board_build.ldscript = ${common.ldscript_1m0m}
+build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_HUESYNC -D WLED_USE_ANALOG_LEDS -D WLED_USE_H801 -D WLED_ENABLE_5CH_LEDS

 [env:d1_mini_5CH_Shojo_PCB]
 board = d1_mini
-platform = ${common.platform_latest}
-board_build.ldscript = ${common.ldscript_4m1m}
-build_flags = ${common.build_flags_esp8266} -D WLED_USE_ANALOG_LEDS -D WLED_USE_SHOJO_PCB -D WLED_ENABLE_5CH_LEDS 
-
+platform =
+${common.platform_latest}
+board_build.ldscript = ${common.ldscript_4m1m}
+build_flags = ${common.build_flags_esp8266} -D WLED_USE_ANALOG_LEDS -D WLED_USE_SHOJO_PCB -D WLED_ENABLE_5CH_LEDS
 # ------------------------------------------------------------------------------
 # DEVELOPMENT BOARDS
 # ------------------------------------------------------------------------------

+
 [env:d1_mini_debug]
 board = d1_mini
 build_type = debug
-platform = ${common.platform_wled_default}
+platform =
+${common.platform_wled_default}
 board_build.ldscript = ${common.ldscript_4m1m}
 build_flags = ${common.build_flags_esp8266} ${common.debug_flags}

@@ -280,42 +280,48 @@
 upload_protocol = espota
 # exchange for your WLED IP
 upload_port = "10.10.1.27"
-platform = ${common.platform_wled_default}
-board_build.ldscript = ${common.ldscript_4m1m}
-build_flags = ${common.build_flags_esp8266} 
-
+platform =
+${common.platform_wled_default}
+board_build.ldscript = ${common.ldscript_4m1m}
+build_flags = ${common.build_flags_esp8266}
 # ------------------------------------------------------------------------------
 # custom board configurations
 # ------------------------------------------------------------------------------

+
 [env:custom_LEDPIN_4]
 board = d1_mini
-platform = ${common.platform_latest}
+platform =
+${common.platform_latest}
 board_build.ldscript = ${common.ldscript_4m1m}
 build_flags = ${common.build_flags_esp8266} -D LEDPIN=4 -D IRPIN=5

 [env:custom_LEDPIN_16]
 board = d1_mini
-platform = ${common.platform_latest}
-board_build.ldscript = ${common.ldscript_4m1m}
-build_flags = ${common.build_flags_esp8266} -D LEDPIN=16 
+platform =
+${common.platform_latest}
+board_build.ldscript = ${common.ldscript_4m1m}
+build_flags = ${common.build_flags_esp8266} -D LEDPIN=16

 [env:custom_APA102]
 board = d1_mini
-platform = ${common.platform_latest}
+platform =
+${common.platform_latest}
 board_build.ldscript = ${common.ldscript_4m1m}
 build_flags = ${common.build_flags_esp8266} -D USE_APA102

 [env:custom_WS2801]
 board = d1_mini
-platform = ${common.platform_latest}
+platform =
+${common.platform_latest}
 board_build.ldscript = ${common.ldscript_4m1m}
 build_flags = ${common.build_flags_esp8266} -D USE_WS2801

 [env:custom32_LEDPIN_16]
 board = esp32dev
 platform = espressif32@1.11.2
-build_flags = ${common.build_flags_esp32} -D LEDPIN=16 
+build_flags =
+${common.build_flags_esp32} -D LEDPIN=16
 lib_ignore =
   ESPAsyncTCP
   ESPAsyncUDP
@@ -326,7 +332,8 @@
 upload_port = /dev/cu.SLAB_USBtoUART
 monitor_port = /dev/cu.SLAB_USBtoUART
 upload_speed = 460800
-build_flags = ${common.build_flags_esp32} -D LEDPIN=16 -D RLYPIN=19 -D BTNPIN=17
+build_flags =
+${common.build_flags_esp32} -D LEDPIN=16 -D RLYPIN=19 -D BTNPIN=17
 lib_ignore =
   ESPAsyncTCP
   ESPAsyncUDP
@@ -334,14 +341,14 @@
 [env:m5atom]
 board = esp32dev
 build_flags = ${common.build_flags_esp32} -D LEDPIN=27 -D BTNPIN=39
-lib_ignore = 
+lib_ignore =
    ESPAsyncTCP
    ESPAsyncUDP
 platform = espressif32@1.11.2
-
 # ------------------------------------------------------------------------------
 # travis test board configurations
 # ------------------------------------------------------------------------------
+

 [env:travis_esp8266]
 extends = env:d1_mini
gepd commented 4 years ago

lol well i was trying to create reproduction steps but I cannot install new libraries, ugh rate limited somehow...

Exception in thread Thread-45:
Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "./python3.3/threading.py", line 858, in run
  File "/Users/shawn/Library/Application Support/Sublime Text 3/Packages/Deviot (Arduino IDE)/libraries/libraries.py", line 99, in download_list
    response = urlopen(req)
  File "./python3.3/urllib/request.py", line 156, in urlopen
  File "./python3.3/urllib/request.py", line 475, in open
  File "./python3.3/urllib/request.py", line 587, in http_response
  File "./python3.3/urllib/request.py", line 513, in error
  File "./python3.3/urllib/request.py", line 447, in _call_chain
  File "./python3.3/urllib/request.py", line 595, in http_error_default
urllib.error.HTTPError: HTTP Error 429: Too Many Requests

Let me wait and see if it resets soon...

It isn't a rate limit look https://github.com/gepd/Deviot/issues/313

I think I forgot to apply some changes to the dev branch, I'll do it in a few hours

Comment counting eval handling is wrong

readconfig write()

                        if(len(comcount) == 0):
                            values = '\n' + values ; <-- NEWLINES after platform = 

This seems wrong, If I remove the \n it works

I'll check this again, It has been a while since I saw this code for the last time, it shouldn't be so hard to fix

tablatronix commented 3 years ago

This has been working pretty good, but there seems to be 1 more bug, debug-flags sections are being removed