Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed MODSERIAL FATFileSystem
Diff: System/config_functions.cpp
- Revision:
- 9:d5fcdcb3c89d
- Child:
- 10:085ab7328054
diff -r 70412939a506 -r d5fcdcb3c89d System/config_functions.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/System/config_functions.cpp Fri Oct 20 11:41:22 2017 +0000
@@ -0,0 +1,96 @@
+#include "config_functions.h"
+#include "StaticDefs.hpp"
+
+int load_BCE_config()
+{
+ ConfigFile cfg;
+ int count = 0;
+ if (!cfg.read("/local/bce.txt")){
+ error("File Read Error");
+ }
+ char value[BUFSIZ];
+
+
+ if (cfg.getValue("PGain", &value[0] , sizeof(value))) {
+ bce().setControllerP(atof(value));
+ count++;
+ }
+ if (cfg.getValue("IGain", &value[0] ,sizeof(value))) {
+ bce().setControllerI(atof(value));
+ count++;
+ }
+ if (cfg.getValue("DGain", &value[0] , sizeof(value))) {
+ bce().setControllerD(atof(value));
+ count++;
+ }
+ if (cfg.getValue("zeroCounts", &value[0],sizeof(value))) {
+ bce().setZeroCounts(atoi(value));
+ count++;
+ }
+ if (cfg.getValue("PistonTravelLimit", &value[0], sizeof(value))) {
+ bce().setTravelLimit(atof(value));
+ count++;
+ }
+ if (cfg.getValue("slope", &value[0], sizeof(value))) {
+ bce().setPotSlope(atof(value));
+ count++;
+ }
+ if (cfg.getValue("filterWn", &value[0], sizeof(value))) {
+ bce().setFilterFrequency(atof(value));
+ count++;
+ }
+ if (cfg.getValue("deadband", &value[0], sizeof(value))) {
+ bce().setDeadband(atof(value));
+ count++;
+ }
+
+
+ return count;
+}
+
+int load_BATT_config()
+{
+ ConfigFile cfg;
+ int count = 0;
+ if (!cfg.read("/local/batt.txt")){
+ error("File Read Error");
+ }
+ char value[BUFSIZ];
+
+
+ if (cfg.getValue("PGain", &value[0] , sizeof(value))) {
+ batt().setControllerP(atof(value));
+ count++;
+ }
+ if (cfg.getValue("IGain", &value[0] ,sizeof(value))) {
+ batt().setControllerI(atof(value));
+ count++;
+ }
+ if (cfg.getValue("DGain", &value[0] , sizeof(value))) {
+ batt().setControllerD(atof(value));
+ count++;
+ }
+ if (cfg.getValue("zeroCounts", &value[0],sizeof(value))) {
+ batt().setZeroCounts(atoi(value));
+ count++;
+ }
+ if (cfg.getValue("PistonTravelLimit", &value[0], sizeof(value))) {
+ batt().setTravelLimit(atof(value));
+ count++;
+ }
+ if (cfg.getValue("slope", &value[0], sizeof(value))) {
+ batt().setPotSlope(atof(value));
+ count++;
+ }
+ if (cfg.getValue("filterWn", &value[0], sizeof(value))) {
+ batt().setFilterFrequency(atof(value));
+ count++;
+ }
+ if (cfg.getValue("deadband", &value[0], sizeof(value))) {
+ batt().setDeadband(atof(value));
+ count++;
+ }
+
+
+ return count;
+}
\ No newline at end of file