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 d4476c9 commit 82a2cba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 3 additions & 6 deletions nesper.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.7.1"
version = "0.7.2"
author = "Jaremy Creechley"
description = "Nim wrappers for ESP-IDF (ESP32)"
license = "Apache-2.0"
Expand All @@ -13,14 +13,10 @@ requires "msgpack4nim >= 0.3.1"
requires "stew >= 0.1.0"
requires "bytesequtils"

# requires "bytesequtils >= 1.1"
# requires "nimcrypto >= 1.0"


# Tasks
import os, strutils

let NFLAGS="--verbosity:0 -d:ESP_IDF_VERSION=" &
const NFLAGS="--verbosity:0 -d:ESP_IDF_VERSION=" &
getEnv("ESP_IDF_VERSION", "4.4") &
" --cincludes:" & (getCurrentDir() / "tests" / "c_headers" / "mock")

Expand All @@ -29,6 +25,7 @@ proc header(msg: string) =

proc testExec(extras, file: string, flags=NFLAGS) =
let cmd = "nim c $1 $2 $3" % [flags, extras, file]
echo("")
echo("Testing: " & $file)
echo "running: ", cmd
exec(cmd)
Expand Down
9 changes: 7 additions & 2 deletions src/nesper/consts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ type


import strutils
from os import getEnv
from macros import error, warning

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

static:
doAssert ESP_IDF_VERSION != "0.0", "Must set esp-idf version using `-d:ESP_IDF_VERSION=4.4`"
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`")


## Definitions for error constants.
Expand Down

0 comments on commit 82a2cba

Please sign in to comment.