Adrian Mitevski / Mbed 2 deprecated mDot_LoRa_Sensornode

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_ModeTaskLightTaskTemperatureTaskPressureTaskHumidityTaskAccelerationTaskGyroscopeTaskMagnetometerTaskProximityTaskGPS
Application_Mode_1XXXXXXXXX
Application_Mode_2.XXX....X
Application_Mode_3.XXX.....
Application_Mode_4....XXX.X
Application_Mode_5....XXX..
Application_Mode_6XX..X...X
Application_Mode_7XX..X....
Application_Mode_8X.......X
Application_Mode_9X........
Application_Mode_10.......XX
Application_Mode_11.......X.

Defining your 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.


All wikipages