Skip to content

Commit

Permalink
- Updating config
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Jan 26, 2018
1 parent e8747c1 commit 7ef83d3
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 12 deletions.
46 changes: 46 additions & 0 deletions extra_scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python
import time
Import("env")

# ------------------------------------------------------------------------------
# Utils
# ------------------------------------------------------------------------------

class Color:
BLACK = '\x1b[1;30m'
RED = '\x1b[1;31m'
GREEN = '\x1b[1;32m'
YELLOW = '\x1b[1;33m'
BLUE = '\x1b[1;34m'
MAGENTA = '\x1b[1;35m'
CYAN = '\x1b[1;36m'
WHITE = '\x1b[1;37m'
LIGHT_GREY = '\x1b[0;30m'
LIGHT_RED = '\x1b[0;31m'
LIGHT_GREEN = '\x1b[0;32m'
LIGHT_YELLOW = '\x1b[0;33m'
LIGHT_BLUE = '\x1b[0;34m'
LIGHT_MAGENTA = '\x1b[0;35m'
LIGHT_CYAN = '\x1b[0;36m'
LIGHT_WHITE = '\x1b[0;37m'

def clr(color, text):
return color + str(text) + '\x1b[0m'

# ------------------------------------------------------------------------------
# Callbacks
# ------------------------------------------------------------------------------

def check_size(source, target, env):
time.sleep(1)
size = target[0].get_size()
print clr(Color.LIGHT_BLUE, "Binary size: %s bytes" % size)
#if size > 512000:
# print clr(Color.LIGHT_RED, "File too large for OTA!")
# Exit(1)

# ------------------------------------------------------------------------------
# Hooks
# ------------------------------------------------------------------------------

env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_size)
33 changes: 21 additions & 12 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,36 @@
; http://docs.platformio.org/en/stable/projectconf.html

[platformio]
env_default = sonoffsc
env_default = sonoff-sc
src_dir = sonoffsc

[env:sonoff-sc]
[common]
platform = atmelavr
board = uno
framework = arduino
build_flags = -DDHT_TYPE=DHT11
build_flags = -Llibs -DDEBUG -Wl,-u,vfprintf -lprintf_flt
lib_deps =
Adafruit Unified Sensor
DHT sensor library
MsTimer2
TimerOne
lib_ignore =
extra_scripts = extra_scripts.py

[env:sonoff-sc]
platform = ${common.platform}
board = ${common.board}
framework = ${common.framework}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DDHT_TYPE=DHT11
extra_scripts = ${common.extra_scripts}

[env:sonoff-sc-pro]
platform = atmelavr
board = uno
framework = arduino
build_flags = -DDHT_TYPE=DHT22
lib_deps =
Adafruit Unified Sensor
DHT sensor library
MsTimer2
TimerOne
platform = ${common.platform}
board = ${common.board}
framework = ${common.framework}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DDHT_TYPE=DHT22
extra_scripts = ${common.extra_scripts}

0 comments on commit 7ef83d3

Please sign in to comment.