Browse Source

make testmode configurable

allow test mode to toggle
add ifndef safty option in config generator
fertito
Daniel Poelzleithner 12 years ago
parent
commit
f2ad741c91
  1. 6
      ezchronos.c
  2. 3
      logic/test.c
  3. 3
      logic/test.h
  4. 25
      tools/config.py

6
ezchronos.c

@ -70,7 +70,9 @@
#endif
#include "rfsimpliciti.h"
#include "simpliciti.h"
#ifdef CONFIG_TEST
#include "test.h"
#endif
// *************************************************************************************************
@ -136,9 +138,11 @@ int main(void)
// Assign initial value to global variables
init_global_variables();
#if CONFIG_TEST
// Branch to welcome screen
test_mode();
#endif
// Main control loop: wait in low power mode until some event needs to be processed
while(1)

3
logic/test.c

@ -35,6 +35,7 @@
// Test functions.
// *************************************************************************************************
#ifdef CONFIG_TEST
// *************************************************************************************************
// Include section
@ -290,3 +291,5 @@ void display_all_off(void)
lcdptr++;
}
}
#endif // CONFIG_TEST

3
logic/test.h

@ -34,6 +34,7 @@
// *************************************************************************************************
// Test functions.
// *************************************************************************************************
#ifdef CONFIG_TEST
#ifndef TEST_H_
#define TEST_H_
@ -43,3 +44,5 @@
extern void test_mode(void);
#endif /*TEST_H_*/
#endif

25
tools/config.py

@ -32,7 +32,8 @@ DATA = {
"THIS_DEVICE_ADDRESS": {
"name": "Hardware address",
"type": "text",
"default": rand_hw()
"default": rand_hw(),
"ifndef": True
},
"DEBUG": {
@ -41,6 +42,18 @@ DATA = {
# modules
"CONFIG_DAY_OF_WEEK": {
"name": "Date: Day of Week",
"depends": [],
"default": True},
"CONFIG_TEST": {
"name": "Test Mode",
"depends": [],
"default": True},
# not yet working
"CONFIG_ACCEL": {
"name": "Accleration",
"depends": [],
@ -65,10 +78,6 @@ DATA = {
"name": "Date",
"depends": [],
"default": True},
"CONFIG_DAY_OF_WEEK": {
"name": "Date: Day of Week",
"depends": [],
"default": True},
"CONFIG_PHASE_CLOCK": {
"name": "Phase Clock",
"depends": [],
@ -81,7 +90,7 @@ DATA = {
"name": "Stop Watch",
"depends": [],
"default": True},
"CONFIG_STOP_TEMP": {
"CONFIG_TEMP": {
"name": "Temperature",
"depends": [],
"default": True},
@ -163,6 +172,8 @@ class OpenChronosApp(npyscreen.NPSApp):
fp.write("// !!!! DO NOT EDIT !!!, use: make config\n")
fp.write(HEADER)
for key,dat in DATA.iteritems():
if DATA[key].get("ifndef", False):
fp.write("#ifndef %s\n" %key)
if isinstance(dat["value"], bool):
if dat["value"]:
fp.write("#define %s\n" %key)
@ -170,6 +181,8 @@ class OpenChronosApp(npyscreen.NPSApp):
fp.write("// %s is not set\n" %key)
else:
fp.write("#define %s %s\n" %(key, dat["value"]))
if DATA[key].get("ifndef", False):
fp.write("#endif // %s\n" %key)
fp.write(FOOTER)

Loading…
Cancel
Save