bellahenkel / Soil-Sensing-Device

A Low-Cost Soil Sensing Project developed at Twin Cities Engineering, Minnesota State University, Mankato
BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Restructure for compatibility with ArduinoIDE & PlatformIO #18

Closed aufdenkampe closed 1 year ago

aufdenkampe commented 1 year ago

Arduino IDE and PlatformIO both have specific requirements the structure of a library, so that sketches and other source files are properly compiled.

The Arduino IDE and PlatformIO Part 1: How to structure a project to be compiled by both blog post describes why putting header and source files in the src directory and .ino sketches in the examples directory is necessary. They provide the following example project as a summary:

senseAndUpload/
├── examples/
|   ├── exampleWifi/
|   │   └── exampleWifi.ino
|   └── exampleNBIoT/
|       └── exampleNBIoT.ino
└── src/
  ├── device/
  |   └── sensor.h
  └── networking/
      ├── nbiot.h
      └── wifi.h

NOTE that as we move or rename files, it is important to use the git mv command to preserve git history. For details and examples, see https://www.educative.io/answers/how-to-rename-or-move-files-in-git.

aufdenkampe commented 1 year ago

A suggested structure for this project might be:

Soil-Sensing-Device/
├── doc/
├── examples/
│   ├── getValuesCO2/
│   │   └── getValuesCO2.ino
│   ├── getValuesModularSensors/
│   │   └── getValuesModularSensors.ino
│   └── runSoilDevice/
│       └── runSoilDevice.ino
└── src/
    ├── main.h
    ├── sensors/
    │   ├── co2_sensor.h
    │   └── co2_sensor.cpp
    └── soilDevice/
        ├── soilDevice.h
        └── soilDevice.cpp
aufdenkampe commented 1 year ago

Maybe model a little bit like https://github.com/EnviroDIY/KellerModbus? I'll look for another example.

aufdenkampe commented 1 year ago

Nice work @bellahenkel! Completed with PR: