Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
e5becea3
Commit
e5becea3
authored
5 years ago
by
koalo
Browse files
Options
Downloads
Patches
Plain Diff
epicardium: BLE opt in
parent
0f46f33a
No related branches found
No related tags found
No related merge requests found
Pipeline
#2417
failed
5 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/main.c
+45
-9
45 additions, 9 deletions
epicardium/main.c
with
45 additions
and
9 deletions
epicardium/main.c
+
45
−
9
View file @
e5becea3
...
...
@@ -30,6 +30,40 @@ TaskHandle_t dispatcher_task_id;
void
vBleTask
(
void
*
pvParameters
);
#define BLEMAXCFGBYTES 100
int
bleShallStart
(
void
)
{
int
bleConfigFile
=
epic_file_open
(
"ble.txt"
,
"r"
);
if
(
bleConfigFile
<
0
)
{
LOG_INFO
(
"startup"
,
"can not open ble.txt -> BLE is not started"
);
return
0
;
}
char
cfgBuf
[
BLEMAXCFGBYTES
+
1
];
int
readNum
=
epic_file_read
(
bleConfigFile
,
cfgBuf
,
BLEMAXCFGBYTES
);
LOG_INFO
(
"startup"
,
"readNum %i"
,
readNum
);
if
(
readNum
<
0
)
{
LOG_INFO
(
"startup"
,
"can not read ble.txt -> BLE is not started"
);
return
0
;
}
cfgBuf
[
readNum
]
=
'\0'
;
LOG_INFO
(
"startup"
,
"faa %s"
,
cfgBuf
);
char
bleActiveStr
[]
=
"active=true"
;
cfgBuf
[
sizeof
(
bleActiveStr
)
-
1
]
=
'\0'
;
LOG_INFO
(
"startup"
,
"foe %i %s"
,
sizeof
(
bleActiveStr
),
cfgBuf
);
if
(
strcmp
(
cfgBuf
,
"active=true"
)
!=
0
)
{
LOG_INFO
(
"startup"
,
"ble.txt is not
\"
active=true
\"
-> BLE is not started"
);
return
0
;
}
LOG_INFO
(
"startup"
,
"ble.txt is
\"
active=true
\"
-> BLE is starting"
);
return
1
;
}
int
main
(
void
)
{
LOG_INFO
(
"startup"
,
"Epicardium startup ..."
);
...
...
@@ -118,6 +152,7 @@ int main(void)
}
/* BLE */
if
(
bleShallStart
())
{
if
(
xTaskCreate
(
vBleTask
,
(
const
char
*
)
"BLE"
,
...
...
@@ -128,6 +163,7 @@ int main(void)
LOG_CRIT
(
"startup"
,
"Failed to create %s task!"
,
"BLE"
);
abort
();
}
}
/* light sensor */
LOG_INFO
(
"startup"
,
"starting light sensor ..."
);
...
...
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