Intermediate commit for system version information refactor

This commit is contained in:
Alden Hart
2016-12-12 08:47:45 -05:00
parent d86fbe35ca
commit 1eb5cad4c8
17 changed files with 64 additions and 62 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
/*
* motate_pin_assignments.h - pin assignments for the Archim boards
* motate_pin_assignments.h - pin assignments
* For: g2core Archim boards
* This file is part of the g2core project
*
* Copyright (c) 2013 - 2016 Robert Giseburt
+1
View File
@@ -1,5 +1,6 @@
/*
* board_stepper.cpp - board-specific code for stepper.cpp
* For: g2core Archim boards
* This file is part of g2core project
*
* Copyright (c) 2016 Alden S. Hart, Jr.
+1
View File
@@ -1,5 +1,6 @@
/*
* board_stepper.h - board-specific code for stepper.h
* For: g2core Archim boards
* This file is part of g2core project
*
* Copyright (c) 2016 Alden S. Hart, Jr.
+1
View File
@@ -1,5 +1,6 @@
/*
* board_xio.cpp - extended IO functions that are board-specific
* For: g2core Archim boards
* This file is part of the g2core project
*
* Copyright (c) 2016 Alden S. Hart Jr.
Executable → Regular
+1
View File
@@ -1,5 +1,6 @@
/*
* board_xio.h - extended IO functions that are board-specific
* For: g2core Archim boards
* This file is part of the g2core project
*
* Copyright (c) 2016 Alden S. Hart Jr.
Executable → Regular
+1
View File
@@ -1,5 +1,6 @@
/*
* hardware.cpp - general hardware support functions
* For: g2core Archim boards
* This file is part of the g2core project
*
* Copyright (c) 2010 - 2015 Alden S. Hart, Jr.
+5 -5
View File
@@ -1,6 +1,7 @@
/*
* hardware.h - system hardware configuration
* THIS FILE IS HARDWARE PLATFORM SPECIFIC - ARM version
* For: g2core Archim boards
* THIS FILE IS HARDWARE PLATFORM SPECIFIC - ARM version
*
* This file is part of the g2core project
*
@@ -61,10 +62,9 @@ enum hwPlatform {
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
////////////////////////////
/////// ARM VERSION ////////
////////////////////////////
/*************************
* Motate Setup *
*************************/
#include "MotatePins.h"
#include "MotateTimers.h" // for TimerChanel<> and related...
+2 -1
View File
@@ -1,5 +1,6 @@
/*
* motate_pin_assignments.h - pin assignments for the g2core Archim boards
* motate_pin_assignments.h
* For: g2core Archim boards
* This file is part of the g2core project
*
* Copyright (c) 2013-2016 Robert Giseburt
Executable → Regular
+16 -22
View File
@@ -94,15 +94,18 @@ void _get_id(char *id)
***********************************************************************************/
/*
* hw_get_fb() - get firmware build number
* hw_get_fv() - get firmware version number
* hw_get_hp() - get hardware platform string
* hw_get_hv() - get hardware version string
* hw_get_fbs() - get firmware build string
*/
stat_t hw_get_fbs(nvObj_t *nv)
{
nv->valuetype = TYPE_STRING;
ritorno(nv_copy_string(nv, G2CORE_FIRMWARE_BUILD_STRING));
return (STAT_OK);
}
stat_t hw_get_fb(nvObj_t *nv) { return (get_float(nv, cs.fw_build)); }
stat_t hw_get_fv(nvObj_t *nv) { return (get_float(nv, cs.fw_version)); }
stat_t hw_get_hp(nvObj_t *nv) { return (get_string(nv, cs.hw_platform)); }
stat_t hw_get_hv(nvObj_t *nv) { return (get_string(nv, cs.hw_version)); }
stat_t hw_get_fbs(nvObj_t *nv) { return (get_string(nv, G2CORE_FIRMWARE_BUILD_STRING)); }
/*
* hw_get_fbc() - get configuration settings file
@@ -140,20 +143,13 @@ stat_t hw_get_id(nvObj_t *nv)
/*
* hw_flash() - invoke FLASH loader from command input
*/
stat_t hw_flash(nvObj_t *nv)
{
hw_flash_loader();
return(STAT_OK);
}
/*
* hw_set_hv() - set hardware version number
*/
stat_t hw_set_hv(nvObj_t *nv)
{
return (STAT_OK);
}
/***********************************************************************************
* TEXT MODE SUPPORT
@@ -163,21 +159,19 @@ stat_t hw_set_hv(nvObj_t *nv)
#ifdef __TEXT_MODE
static const char fmt_fb[] = "[fb] firmware build%18.2f\n";
static const char fmt_fv[] = "[fv] firmware version%16.2f\n";
static const char fmt_fbs[] = "[fbs] firmware build \"%32s\"\n";
static const char fmt_fbc[] = "[fbc] firmware config \"%s\"\n";
static const char fmt_fv[] = "[fv] firmware version%16.2f\n";
static const char fmt_cv[] = "[cv] configuration version%11.2f\n";
static const char fmt_hp[] = "[hp] hardware platform%15.2f\n";
static const char fmt_hv[] = "[hv] hardware version%16.2f\n";
static const char fmt_hp[] = "[hp] hardware platform%15s\n";
static const char fmt_hv[] = "[hv] hardware version%16s\n";
static const char fmt_id[] = "[id] g2core ID%21s\n";
void hw_print_fb(nvObj_t *nv) { text_print(nv, fmt_fb);} // TYPE_FLOAT
void hw_print_fv(nvObj_t *nv) { text_print(nv, fmt_fv);} // TYPE_FLOAT
void hw_print_fbs(nvObj_t *nv) { text_print(nv, fmt_fbs);} // TYPE_STRING
void hw_print_fbc(nvObj_t *nv) { text_print(nv, fmt_fbc);} // TYPE_STRING
void hw_print_fv(nvObj_t *nv) { text_print(nv, fmt_fv);} // TYPE_FLOAT
void hw_print_cv(nvObj_t *nv) { text_print(nv, fmt_cv);} // TYPE_FLOAT
void hw_print_hp(nvObj_t *nv) { text_print(nv, fmt_hp);} // TYPE_FLOAT
void hw_print_hv(nvObj_t *nv) { text_print(nv, fmt_hv);} // TYPE_FLOAT
void hw_print_hp(nvObj_t *nv) { text_print(nv, fmt_hp);} // TYPE_STRING
void hw_print_hv(nvObj_t *nv) { text_print(nv, fmt_hv);} // TYPE_STRING
void hw_print_id(nvObj_t *nv) { text_print(nv, fmt_id);} // TYPE_STRING
#endif //__TEXT_MODE
+7 -16
View File
@@ -37,20 +37,8 @@
/*--- Hardware platform enumerations ---*/
enum hwPlatform {
HM_PLATFORM_NONE = 0,
HW_PLATFORM_TINYG_XMEGA, // TinyG code base on Xmega boards.
HW_PLATFORM_G2_DUE, // G2 code base on native Arduino Due
HW_PLATFORM_V9 // G2 code base on v9 boards
};
#define HW_VERSION_TINYGV6 6
#define HW_VERSION_TINYGV7 7
#define HW_VERSION_TINYGV8 8
#define HW_VERSION_TINYGV9I 4
#define HW_VERSION_TINYGV9K 5
#define G2CORE_HARDWARE_PLATFORM "g2v9" // cannot exceed 15 bytes!!!
#define G2CORE_HARDWARE_VERSION "k" // cannot exceed 15 bytes!!!
/***** Axes, motors & PWM channels used by the application *****/
// Axes, motors & PWM channels must be defines (not enums) so expressions like this:
@@ -177,6 +165,11 @@ stat_t hardware_periodic(); // callback from the main loop (time sensitive)
void hw_hard_reset(void);
stat_t hw_flash(nvObj_t *nv);
stat_t hw_get_fb(nvObj_t *nv);
stat_t hw_get_fv(nvObj_t *nv);
stat_t hw_get_hp(nvObj_t *nv);
stat_t hw_get_hv(nvObj_t *nv);
stat_t hw_get_fbs(nvObj_t *nv);
stat_t hw_get_fbc(nvObj_t *nv);
stat_t hw_set_hv(nvObj_t *nv);
@@ -188,7 +181,6 @@ stat_t hw_get_id(nvObj_t *nv);
void hw_print_fbs(nvObj_t *nv);
void hw_print_fbc(nvObj_t *nv);
void hw_print_fv(nvObj_t *nv);
void hw_print_cv(nvObj_t *nv);
void hw_print_hp(nvObj_t *nv);
void hw_print_hv(nvObj_t *nv);
void hw_print_id(nvObj_t *nv);
@@ -199,7 +191,6 @@ stat_t hw_get_id(nvObj_t *nv);
#define hw_print_fbs tx_print_stub
#define hw_print_fbc tx_print_stub
#define hw_print_fv tx_print_stub
#define hw_print_cv tx_print_stub
#define hw_print_hp tx_print_stub
#define hw_print_hv tx_print_stub
#define hw_print_id tx_print_stub
-5
View File
@@ -61,11 +61,6 @@ enum hwPlatform {
#define COORDS 6 // number of supported coordinate systems (1-6)
#define PWMS 2 // number of supported PWM channels
////////////////////////////
/////// ARM VERSION ////////
////////////////////////////
#include "MotatePins.h"
#include "MotateTimers.h" // for TimerChanel<> and related...
#include "MotateServiceCall.h" // for ServiceCall<>
+2
View File
@@ -363,6 +363,8 @@ stat_t set_float_range(nvObj_t *nv, float &value, float low, float high);
stat_t get_int(nvObj_t *nv, const uint8_t value); // boilerplate for retrieving an integer value
stat_t set_int(nvObj_t *nv, uint8_t &value, uint8_t low, uint8_t high);
stat_t get_string(nvObj_t *nv, const char *str);
// diagnostics
void nv_dump_nv(nvObj_t *nv);
+13 -5
View File
@@ -102,13 +102,13 @@ static stat_t get_tick(nvObj_t *nv); // get system tick count
* the %f in the corresponding format string to set text mode display precision
*/
const cfgItem_t cfgArray[] = {
// group token flags p, print_func, get_func, set_func, target for get/set, default value
{ "sys", "fb", _fipn,2, hw_print_fb, get_flt, set_nul, (float *)&cs.fw_build, G2CORE_FIRMWARE_BUILD }, // MUST BE FIRST!
// group token flags p, print_func, get_func, set_func, get/set target, default value
{ "sys", "fb", _fipn,2, hw_print_fb, hw_get_fb, set_nul, (float *)&cs.null, 0 }, // MUST BE FIRST for persistence checking!
{ "sys", "fv", _fipn,2, hw_print_fv, hw_get_fv, set_nul, (float *)&cs.null, 0 },
{ "sys", "fbs",_fn, 2, hw_print_fbs, hw_get_fbs, set_nul, (float *)&cs.null, 0 },
{ "sys", "fbc",_fn, 2, hw_print_fbc, hw_get_fbc, set_nul, (float *)&cs.null, 0 },
{ "sys", "fv", _fipn,2, hw_print_fv, get_flt, set_nul, (float *)&cs.fw_version, G2CORE_FIRMWARE_VERSION },
{ "sys", "hp", _fipn,0, hw_print_hp, get_flt, set_nul, (float *)&cs.hw_platform, G2CORE_HARDWARE_PLATFORM },
{ "sys", "hv", _fipn,0, hw_print_hv, get_flt, set_nul, (float *)&cs.hw_version, G2CORE_HARDWARE_VERSION },
{ "sys", "hp", _fipn,0, hw_print_hp, hw_get_hp, set_nul, (float *)&cs.null, 0 },
{ "sys", "hv", _fipn,0, hw_print_hv, hw_get_hv, set_nul, (float *)&cs.null, 0 },
{ "sys", "id", _fn, 0, hw_print_id, hw_get_id, set_nul, (float *)&cs.null, 0 }, // device ID (ASCII signature)
// dynamic model attributes for reporting purposes (up front for speed)
@@ -1106,7 +1106,15 @@ stat_t set_int(nvObj_t *nv, uint8_t &value, uint8_t low, uint8_t high) {
return (STAT_OK);
}
/*
* get_string() - boilerplate for retrieving a string value
*/
stat_t get_string(nvObj_t *nv, const char *str)
{
nv->valuetype = TYPE_STRING;
return (nv_copy_string(nv, str));
}
/*
* nv_group_is_prefixed() - hack
+4 -1
View File
@@ -95,7 +95,10 @@ void controller_init()
cs.comm_mode = comm_mode; // restore parameters
cs.fw_build = G2CORE_FIRMWARE_BUILD; // set up identification
cs.fw_version = G2CORE_FIRMWARE_VERSION;
cs.hw_platform = G2CORE_HARDWARE_PLATFORM; // NB: HW version is set from EEPROM
// cs.hw_platform = G2CORE_HARDWARE_PLATFORM;
strncpy(cs.hw_platform, G2CORE_HARDWARE_PLATFORM, HARDWARE_STRING);
strncpy(cs.hw_version, G2CORE_HARDWARE_VERSION, HARDWARE_STRING);
cs.controller_state = CONTROLLER_STARTUP; // ready to run startup lines
if (xio_connected()) {
cs.controller_state = CONTROLLER_CONNECTED;
Executable → Regular
+5 -2
View File
@@ -32,6 +32,7 @@
#define SAVED_BUFFER_LEN 80 // saved buffer size (for reporting only)
#define MAXED_BUFFER_LEN 255 // same as streaming RX buffer size as a worst case
#define OUTPUT_BUFFER_LEN 512 // text buffer size
#define HARDWARE_STRING 16 // max length for hw platform and version is 15 chars
#define LED_NORMAL_BLINK_RATE 3000 // blink rate for normal operation (in ms)
#define LED_ALARM_BLINK_RATE 750 // blink rate for alarm state (in ms)
@@ -54,8 +55,10 @@ typedef struct controllerSingleton { // main TG controller struct
// system identification values
float fw_build; // firmware build number
float fw_version; // firmware version number
float hw_platform; // hardware compatibility - platform type
float hw_version; // hardware compatibility - platform revision
// float hw_platform; // hardware compatibility - platform type
// float hw_version; // hardware compatibility - platform revision
char hw_platform[HARDWARE_STRING]; // hardware compatibility - platform type
char hw_version[HARDWARE_STRING]; // hardware compatibility - platform revision
// system state variables
csControllerState controller_state;
+2 -4
View File
@@ -22,14 +22,12 @@
#define G2CORE_INFO_H_ONCE
#define G2CORE_FIRMWARE_BUILD 100.12 // Changes to USB serial for SAMS70 and SAM8X targets
#define G2CORE_FIRMWARE_VERSION 0.99 // firmware major version
#ifdef GIT_VERSION
#define G2CORE_FIRMWARE_BUILD_STRING GIT_VERSION
#else
#define G2CORE_FIRMWARE_BUILD_STRING "unknown"
#endif
#define G2CORE_FIRMWARE_VERSION 0.99 // firmware major version
#define G2CORE_HARDWARE_PLATFORM HW_PLATFORM_V9 // hardware platform indicator (2 = Native Arduino Due)
#define G2CORE_HARDWARE_VERSION HW_VERSION_TINYGV9K // hardware platform revision number
#define G2CORE_HARDWARE_VERSION_MAX (G2CORE_HARDWARE_VERSION)
#endif // G2CORE_INFO_H_ONCE
+1
View File
@@ -282,6 +282,7 @@ void text_print(nvObj_t *nv, const char *format) {
static const char fmt_tv[] = "[tv] text verbosity%15d [0=silent,1=verbose]\n";
void tx_print_tv(nvObj_t *nv) { text_print(nv, fmt_tv);} // TYPE_INT
/***********************************************************************************
* CONFIGURATION AND INTERFACE FUNCTIONS
* Functions to get and set variables from the cfgArray table