Skip to content
Snippets Groups Projects
Commit e5becea3 authored by koalo's avatar koalo
Browse files

epicardium: BLE opt in

parent 0f46f33a
No related branches found
No related tags found
No related merge requests found
Pipeline #2417 failed
......@@ -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 ...");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment