How yangyuanxin/iotsensordetect works
IotSensorDetect is STM32 firmware for gas sensing, organized around an MVC application and a state-driven detection workflow. The documented control mode accepts START, STOP, and return/previous commands; detection moves through calibration, detection, and result states. A separate auto-report mode sends periodic device status and sensor values to the app. The graph includes the sensor/display, protocol, and MQTT layers supported by the tree and documentation; most application implementation files were not sampled, so uncertain internal call wiring is omitted.
Main entry points: Controller.c Controller · mqttclient.c MQTT client · MQ_2.c Gas sensor · App.c App coordinator
Components 17
Application
- App coordinator
Software/APP/App.c - Controller
Software/APP/Controller.c - State model
Software/APP/Model.c
Sensing and UI
- Display view
Software/APP/View.c - Gas sensor
Software/Bsp/MQ_2.c - Sensor interface
Software/Bsp/Bh750.c - LCD driver
Software/Bsp/Lcd.c
Connectivity
- Sensor protocol
Software/Common/data_protocol/sensor_protocol.c - JSON codec
Software/Common/cJSON/cJSON.c - MQTT client
Software/Common/mqttclient/mqttclient/mqttclient.c - MQTT packet
Software/Common/mqttclient/mqtt - Network transport
Software/Common/mqttclient/network/network.c
MCU platform
- Firmware entry
Software/McuPlatform/Core/Src/main.c - MCU peripherals
Software/McuPlatform/Core/Src/adc.c
Other components
- App user
- Mobile app
- MQTT broker
Connections 19
- App user → Mobile app: issues commands
- Mobile app → Controller: sends control
- Firmware entry → App coordinator: starts
- App coordinator → Controller: coordinates
- Controller → State model: dispatches events
- State model → Controller: returns state
- Controller → Gas sensor: requests readings
- Gas sensor → Controller: returns values
- Controller → Sensor interface: uses sensor interface
- Controller → Display view: updates display
- Display view → LCD driver: renders
- Controller → Sensor protocol: encodes reports
- Controller → JSON codec: parses messages
- Controller → MQTT client: publishes and subscribes
- MQTT client → MQTT packet: serializes packets
- MQTT client → Network transport: transfers packets
- Network transport → MQTT broker: connects
- MQTT broker → MQTT client: delivers messages
- MCU peripherals → Gas sensor: supports acquisition