Skip to content

Commit

Permalink
improve error checks and messages
Browse files Browse the repository at this point in the history
  • Loading branch information
elcritch committed Jul 23, 2024
1 parent 82a2cba commit 5a3e069
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nesper.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.7.2"
version = "0.7.3"
author = "Jaremy Creechley"
description = "Nim wrappers for ESP-IDF (ESP32)"
license = "Apache-2.0"
Expand Down
6 changes: 4 additions & 2 deletions src/nesper/consts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ from os import getEnv
from macros import error, warning

const
ESP_IDF_VERSION* {.strdefine.} = getEnv("ESP_IDF_VERSION", "0.0")
ESP_IDF_MAJOR* {.intdefine.} = ESP_IDF_VERSION.split(".")[0].parseInt()
ESP_IDF_VERSION* {.strdefine.} = getEnv("ESP_IDF_VERSION", "0.0").toLower().replace("v","")
ESP_IDF_MAJOR* {.intdefine.} = ESP_IDF_VERSION. split(".")[0].parseInt()
ESP_IDF_MINOR* {.intdefine.} = ESP_IDF_VERSION.split(".")[1].parseInt()

static:
if ESP_IDF_MAJOR notin [4, 5]:
error("Incorrect esp-idf major version: " & $ESP_IDF_MAJOR)
if ESP_IDF_VERSION == "0.0":
warning("ESP_IDF_VERSION: " & ESP_IDF_VERSION)
error("Must set esp-idf version using `-d:ESP_IDF_VERSION=4.4` or using an environment variable `export ESP_IDF_VERSION=4.4`")
Expand Down

0 comments on commit 5a3e069

Please sign in to comment.