Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

  1. #!/usr/bin/env python
  2. import time
  3. Import("env")
  4. # ------------------------------------------------------------------------------
  5. # Utils
  6. # ------------------------------------------------------------------------------
  7. class Color:
  8. BLACK = '\x1b[1;30m'
  9. RED = '\x1b[1;31m'
  10. GREEN = '\x1b[1;32m'
  11. YELLOW = '\x1b[1;33m'
  12. BLUE = '\x1b[1;34m'
  13. MAGENTA = '\x1b[1;35m'
  14. CYAN = '\x1b[1;36m'
  15. WHITE = '\x1b[1;37m'
  16. LIGHT_GREY = '\x1b[0;30m'
  17. LIGHT_RED = '\x1b[0;31m'
  18. LIGHT_GREEN = '\x1b[0;32m'
  19. LIGHT_YELLOW = '\x1b[0;33m'
  20. LIGHT_BLUE = '\x1b[0;34m'
  21. LIGHT_MAGENTA = '\x1b[0;35m'
  22. LIGHT_CYAN = '\x1b[0;36m'
  23. LIGHT_WHITE = '\x1b[0;37m'
  24. def clr(color, text):
  25. return color + str(text) + '\x1b[0m'
  26. # ------------------------------------------------------------------------------
  27. # Callbacks
  28. # ------------------------------------------------------------------------------
  29. def check_size(source, target, env):
  30. time.sleep(1)
  31. size = target[0].get_size()
  32. print clr(Color.LIGHT_BLUE, "Binary size: %s bytes" % size)
  33. #if size > 512000:
  34. # print clr(Color.LIGHT_RED, "File too large for OTA!")
  35. # Exit(1)
  36. # ------------------------------------------------------------------------------
  37. # Hooks
  38. # ------------------------------------------------------------------------------
  39. env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", check_size)