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:
- 10:085ab7328054
- Parent:
- 9:d5fcdcb3c89d
- Child:
- 11:3b241ecb75ed
--- a/System/config_functions.cpp Fri Oct 20 11:41:22 2017 +0000
+++ b/System/config_functions.cpp Mon Oct 23 12:50:53 2017 +0000
@@ -5,12 +5,11 @@
{
ConfigFile cfg;
int count = 0;
- if (!cfg.read("/local/bce.txt")){
+ 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++;
@@ -44,7 +43,6 @@
count++;
}
-
return count;
}
@@ -52,9 +50,9 @@
{
ConfigFile cfg;
int count = 0;
- if (!cfg.read("/local/batt.txt")){
+ if (!cfg.read("/local/batt.txt")) {
error("File Read Error");
- }
+ }
char value[BUFSIZ];
@@ -91,6 +89,71 @@
count++;
}
+ return count;
+}
+
+int load_DEPTH_config()
+{
+ ConfigFile cfg;
+ int count = 0;
+ if (!cfg.read("/local/depth.txt")) {
+ error("File Read Error");
+ }
+ char value[BUFSIZ];
- return count;
+ if (cfg.getValue("PGain", &value[0] , sizeof(value))) {
+ depthLoop().setControllerP(atof(value));
+ count++;
+ }
+ if (cfg.getValue("IGain", &value[0] ,sizeof(value))) {
+ depthLoop().setControllerI(atof(value));
+ count++;
+ }
+ if (cfg.getValue("DGain", &value[0] , sizeof(value))) {
+ depthLoop().setControllerD(atof(value));
+ count++;
+ }
+ if (cfg.getValue("filterWn", &value[0], sizeof(value))) {
+ depthLoop().setFilterFrequency(atof(value));
+ count++;
+ }
+ if (cfg.getValue("deadband", &value[0], sizeof(value))) {
+ depthLoop().setDeadband(atof(value));
+ count++;
+ }
+
+ return count;
+}
+
+int load_PITCH_config()
+{
+ ConfigFile cfg;
+ int count = 0;
+ if (!cfg.read("/local/pitch.txt")){
+ error("File Read Error");
+ }
+ char value[BUFSIZ];
+
+ if (cfg.getValue("PGain", &value[0] , sizeof(value))) {
+ pitchLoop().setControllerP(atof(value));
+ count++;
+ }
+ if (cfg.getValue("IGain", &value[0] ,sizeof(value))) {
+ pitchLoop().setControllerI(atof(value));
+ count++;
+ }
+ if (cfg.getValue("DGain", &value[0] , sizeof(value))) {
+ pitchLoop().setControllerD(atof(value));
+ count++;
+ }
+ if (cfg.getValue("filterWn", &value[0], sizeof(value))) {
+ pitchLoop().setFilterFrequency(atof(value));
+ count++;
+ }
+ if (cfg.getValue("deadband", &value[0], sizeof(value))) {
+ pitchLoop().setDeadband(atof(value));
+ count++;
+ }
+
+ return count;
}
\ No newline at end of file