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: mDot_LoRa_Sensornode_Flowmeter_impl mbed-rtos mbed
You are viewing an older revision! See the latest version
Application Modes
Application Modes¶
There are some predefined Application Modes that define which measurements are taken. Each measurment is encapsulated in a Task. So therefore the Tasks that run define which measurments are taken.
| Application_Mode | TaskLight | TaskTemperature | TaskPressure | TaskHumidity | TaskAcceleration | TaskGyroscope | TaskMagnetometer | TaskProximity | TaskGPS |
|---|---|---|---|---|---|---|---|---|---|
| Application_Mode_1 | X | X | X | X | X | X | X | X | X |
| Application_Mode_2 | . | X | X | X | . | . | . | . | X |
| Application_Mode_3 | . | X | X | X | . | . | . | . | . |
| Application_Mode_4 | . | . | . | . | X | X | X | . | X |
| Application_Mode_5 | . | . | . | . | X | X | X | . | . |
| Application_Mode_6 | X | X | . | . | X | . | . | . | X |
| Application_Mode_7 | X | X | . | . | X | . | . | . | . |
| Application_Mode_8 | X | . | . | . | . | . | . | . | X |
| Application_Mode_9 | X | . | . | . | . | . | . | . | . |
| Application_Mode_10 | . | . | . | . | . | . | . | X | X |
| Application_Mode_11 | . | . | . | . | . | . | . | X | . |
Defining own Application Modes¶
Which tasks are running (Sensors are measuring) is defined inside ApplicationConfig::build(APPLICATION_MODE)
definition of an Application Mode inside ApplicationConfig::build(APPLICATION_MODE)
void ApplicationConfig::build(APPLICATION_MODE desiredMode) {
switch (desiredMode) {
...
case APPLICATION_MODE_2:
setStateTaskLight(SLEEPING);
setStateTaskTemperature(RUNNING);
setStateTaskPressure(RUNNING);
setStateTaskHumidity(RUNNING);
setStateTaskAcceleration(SLEEPING);
setStateTaskGyroscope(SLEEPING);
setStateTaskTesla(SLEEPING);
setStateTaskProximity(SLEEPING);
setStateTaskGPS(RUNNING);
setStateTaskLoRaMeasurement(SLEEPING);
setMAX44009_MODE(MAX44009_MODE_1);
setBME280_MODE(BME280_MODE_1);
setMPU9250_MODE(MPU9250_MODE_1);
setSI1143_MODE(SI1143_MODE_1);
setuBlox_MODE(uBLOX_MODE_1);
setLORA_MODE(LORA_MODE_1);
break;
...
}
}
The setStateTaskXXX(TASK_STATE) methods are used to set a Task(Measurement) running or sleeping. Its possible to adapt the existing modes by changing the TASK_STATE or defining some new Modes by defining an new Application Mode Enum and adding it as an additional switch-case.