Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CoincellExperimentController
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Klemm, Carl Philipp
CoincellExperimentController
Commits
8f11bbd8
Commit
8f11bbd8
authored
1 year ago
by
Carl Philipp Klemm
Browse files
Options
Downloads
Patches
Plain Diff
add mcu watchdog support
parent
0c4bafd4
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
heater.cpp
+3
-0
3 additions, 0 deletions
heater.cpp
heaters.h
+1
-0
1 addition, 0 deletions
heaters.h
main.cpp
+8
-2
8 additions, 2 deletions
main.cpp
options.h
+5
-0
5 additions, 0 deletions
options.h
with
17 additions
and
2 deletions
heater.cpp
+
3
−
0
View file @
8f11bbd8
...
@@ -75,6 +75,8 @@ void Heaters::recoverDevice(int device)
...
@@ -75,6 +75,8 @@ void Heaters::recoverDevice(int device)
coincellhell_reset_bus
(
&
devices
[
device
].
device
);
coincellhell_reset_bus
(
&
devices
[
device
].
device
);
coincellhell_disconnect
(
&
devices
[
device
].
device
);
coincellhell_disconnect
(
&
devices
[
device
].
device
);
ret
=
coincellhell_connect
(
&
devices
[
device
].
device
,
devices
[
device
].
serial
);
ret
=
coincellhell_connect
(
&
devices
[
device
].
device
,
devices
[
device
].
serial
);
if
(
watchdogs
)
coincellhell_enable_watchdog
(
&
devices
[
device
].
device
);
}
}
devices
[
device
].
mutex
->
unlock
();
devices
[
device
].
mutex
->
unlock
();
...
@@ -394,6 +396,7 @@ void Heaters::safetyCheck()
...
@@ -394,6 +396,7 @@ void Heaters::safetyCheck()
void
Heaters
::
enableWatchdogs
()
void
Heaters
::
enableWatchdogs
()
{
{
watchdogs
=
true
;
for
(
struct
device
&
device
:
devices
)
for
(
struct
device
&
device
:
devices
)
{
{
device
.
mutex
->
lock
();
device
.
mutex
->
lock
();
...
...
This diff is collapsed.
Click to expand it.
heaters.h
+
1
−
0
View file @
8f11bbd8
...
@@ -35,6 +35,7 @@ private:
...
@@ -35,6 +35,7 @@ private:
};
};
std
::
vector
<
struct
device
>
devices
;
std
::
vector
<
struct
device
>
devices
;
bool
watchdogs
=
false
;
std
::
function
<
void
(
int
device
,
uint16_t
serial
,
int
code
)
>
deviceFailCb
;
std
::
function
<
void
(
int
device
,
uint16_t
serial
,
int
code
)
>
deviceFailCb
;
std
::
function
<
void
(
int
heater
,
int
device
)
>
heaterFailCb
;
std
::
function
<
void
(
int
heater
,
int
device
)
>
heaterFailCb
;
...
...
This diff is collapsed.
Click to expand it.
main.cpp
+
8
−
2
View file @
8f11bbd8
...
@@ -57,7 +57,7 @@ static void loggingThreadFn(Heaters* heaters, Multiplexers* multiplexers,
...
@@ -57,7 +57,7 @@ static void loggingThreadFn(Heaters* heaters, Multiplexers* multiplexers,
static
unsigned
int
step
=
0
;
static
unsigned
int
step
=
0
;
Log
(
Log
::
INFO
)
<<
"Logging thread has started"
;
Log
(
Log
::
INFO
)
<<
"Logging thread has started"
;
std
::
filesystem
::
path
logfile
=
outdir
/
"expiramentlog.
txt
"
;
std
::
filesystem
::
path
logfile
=
outdir
/
"expiramentlog.
csv
"
;
std
::
fstream
file
(
logfile
,
std
::
ios_base
::
out
);
std
::
fstream
file
(
logfile
,
std
::
ios_base
::
out
);
if
(
!
file
.
is_open
())
if
(
!
file
.
is_open
())
...
@@ -105,7 +105,7 @@ static void loggingThreadFn(Heaters* heaters, Multiplexers* multiplexers,
...
@@ -105,7 +105,7 @@ static void loggingThreadFn(Heaters* heaters, Multiplexers* multiplexers,
file
<<
temp
<<
','
;
file
<<
temp
<<
','
;
}
}
file
<<
std
::
endl
;
file
<<
std
::
endl
;
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
5
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
10
));
}
}
}
}
...
@@ -252,6 +252,12 @@ int main(int argc, char** argv)
...
@@ -252,6 +252,12 @@ int main(int argc, char** argv)
return
2
;
return
2
;
}
}
if
(
config
.
watchdog
)
{
Log
(
Log
::
INFO
)
<<
"Enableing mcu watchdogs"
;
heaters
.
enableWatchdogs
();
}
ret
=
expirament
.
run
(
config
.
globalStep
,
config
.
subStep
);
ret
=
expirament
.
run
(
config
.
globalStep
,
config
.
subStep
);
expirament
.
shutdown
();
expirament
.
shutdown
();
...
...
This diff is collapsed.
Click to expand it.
options.h
+
5
−
0
View file @
8f11bbd8
...
@@ -31,6 +31,7 @@ static struct argp_option options[] =
...
@@ -31,6 +31,7 @@ static struct argp_option options[] =
{
"sub-step"
,
'k'
,
"[STEP NUMBER]"
,
0
,
"sets the subset of the expirament"
},
{
"sub-step"
,
'k'
,
"[STEP NUMBER]"
,
0
,
"sets the subset of the expirament"
},
{
"stepfile"
,
'f'
,
"[PATH]"
,
0
,
"sets the subset of the expirament"
},
{
"stepfile"
,
'f'
,
"[PATH]"
,
0
,
"sets the subset of the expirament"
},
{
"skip-start"
,
'z'
,
0
,
0
,
"skipps the startup sequence"
},
{
"skip-start"
,
'z'
,
0
,
0
,
"skipps the startup sequence"
},
{
"watchdog"
,
'w'
,
0
,
0
,
"enable mcu watchdogs"
},
{
0
}
{
0
}
};
};
...
@@ -50,6 +51,7 @@ struct Config
...
@@ -50,6 +51,7 @@ struct Config
size_t
globalStep
=
0
;
size_t
globalStep
=
0
;
size_t
subStep
=
0
;
size_t
subStep
=
0
;
bool
skipstart
=
false
;
bool
skipstart
=
false
;
bool
watchdog
=
false
;
};
};
static
std
::
vector
<
uint16_t
>
parseList
(
const
std
::
string
&
in
)
static
std
::
vector
<
uint16_t
>
parseList
(
const
std
::
string
&
in
)
...
@@ -116,6 +118,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
...
@@ -116,6 +118,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
case
'z'
:
case
'z'
:
config
->
skipstart
=
true
;
config
->
skipstart
=
true
;
break
;
break
;
case
'w'
:
config
->
watchdog
=
true
;
break
;
default:
default:
return
ARGP_ERR_UNKNOWN
;
return
ARGP_ERR_UNKNOWN
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment