Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

MCP3424 #75

Open
wants to merge 181 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
378974f
Started MCP3424 module
Razican Feb 23, 2015
c69fc27
Merge branch 'develop' into feature/MCP3424
Razican Feb 23, 2015
2dd24c1
Added contribution agreement
Razican Feb 23, 2015
850f904
Merge branch 'develop' into feature/MCP3424
Razican Feb 23, 2015
58cf517
PCB Design Added
jordanaranda Feb 23, 2015
a7217be
Moved PCB design and updated bandit
Razican Feb 24, 2015
0213f20
Added camera test
Razican Feb 25, 2015
26e4ae1
Better config generation
Razican Feb 25, 2015
3ded729
Added controller for the GSM module. Software power control has been …
cruzeneko Mar 15, 2015
0cd492e
Changed MCP working directory
Razican Mar 31, 2015
cf9636f
Modified SMS termination string. Changed \r\n to \x1a\r\n to meet SIM…
cruzeneko Mar 31, 2015
b6cbdba
Implemented geolocation and GPRS connections. Not tested yet.
cruzeneko Mar 31, 2015
7d0c4b1
Improved software power control.
cruzeneko Mar 31, 2015
f33e91a
Updated to C++14
Razican Apr 15, 2015
74be949
Added logger and started logic
Razican Jul 16, 2015
251ed7a
Added camera initialization
Razican Jul 16, 2015
91f06dd
Better build script
Razican Jul 16, 2015
0aea04b
Added g++4.9 flag
Razican Jul 16, 2015
5886264
Debugging segmentation fault
Razican Jul 16, 2015
8ca30c3
Continue debugging
Razican Jul 16, 2015
80adf7a
Continue debugging... It works perfectly in my system though.
Razican Jul 16, 2015
ce9fa76
Possible cause found
Razican Jul 16, 2015
36babbb
Dammmnnnn no way this is happening
Razican Jul 16, 2015
65b0661
Could it be this issue?
Razican Jul 16, 2015
cabffb3
OK, new attempt
Razican Jul 16, 2015
57748bb
More debugging
Razican Jul 16, 2015
999b1fe
Added more debugging messages.
Razican Jul 16, 2015
024440b
Added more debugging messages, again.
Razican Jul 16, 2015
bcfb59b
Created data directories in build script
Razican Jul 16, 2015
38ac618
Removed debug information
Razican Jul 16, 2015
14ec1df
Removed more debug messages
Razican Jul 16, 2015
2e238eb
Added first logic structure
Razican Jul 16, 2015
124eeb2
Code refactored
Razican Jul 18, 2015
78f56b3
Merge branch 'feature/gsm' into develop
Razican Jul 18, 2015
dcae77f
Merge branch 'develop' into feature/logic
Razican Jul 18, 2015
c96a495
Small fixes
Razican Jul 19, 2015
95b51a8
Free space instead of available space
Razican Jul 19, 2015
fb89068
Available space must be float or overflows in 32 bits
Razican Jul 19, 2015
34cdb94
Added a bit of logic
Razican Jul 19, 2015
d4fda18
Added some debug fields
Razican Jul 19, 2015
97491c2
Added GSM logic
Razican Jul 19, 2015
b124ff7
Uncommented success message
Razican Jul 19, 2015
7bdcac6
Added off TODO
Razican Jul 19, 2015
9b4398e
GPS added
Razican Jul 20, 2015
d77d7c6
Fixed configure script
Razican Jul 20, 2015
6bd326f
Fixed configure script
Razican Jul 20, 2015
f931ea2
Fixed camera tests and debugging serial
Razican Jul 20, 2015
c9061e6
Removed config.h file, it's automatically generated.
Razican Jul 20, 2015
2edd051
Trying to fix GPS
Razican Jul 20, 2015
482d30f
Removed unused files from makefile
Razican Jul 20, 2015
c034a34
Fixing GPS serial
Razican Jul 20, 2015
53e8f3f
It was still failing
Razican Jul 20, 2015
75da206
Fixed baudrate for GPS
Razican Jul 20, 2015
08f4418
All logic added except for recovery and some error control
Razican Jul 20, 2015
444849c
Readme polished.
Razican Jul 20, 2015
d1ba1b7
Merge branch 'feature/logic' into develop
Razican Jul 20, 2015
a6882ea
Merge branch 'develop' into feature/camera_test
Razican Jul 20, 2015
ff8640e
Improved camera tests
Razican Jul 20, 2015
c23aa1d
Updated bandit
Razican Jul 20, 2015
92a4164
Merge branch 'develop' into feature/camera_test
Razican Jul 20, 2015
54cd7e2
Trying to fix build
Razican Jul 20, 2015
03d740d
Fixing build in Raspberry
Razican Jul 20, 2015
0550835
Merge branch 'feature/camera_test' into develop
Razican Jul 20, 2015
1fa4ca6
Removed unused autogen.sh
Razican Jul 20, 2015
938a244
Commented some logic to be able to test it
Razican Jul 20, 2015
e806d9b
Better GPS logging and recording stop flag.
Razican Jul 20, 2015
ad2bf2f
There were too many repeated logs.
Razican Jul 20, 2015
1086d97
15 minutes was too much
Razican Jul 20, 2015
38ca2fd
GPS was not being correctly configured.
Razican Jul 20, 2015
a4eb627
Added more options to camera
Razican Jul 23, 2015
a4e7b61
Fixed small issues
Razican Jul 23, 2015
1ef69b3
GPS parser failed on configuration frames
Razican Jul 23, 2015
e93f1b1
Fixed more things and started real testing
Razican Jul 28, 2015
aa84968
More progress in the server script. Still some SMS failing.
Razican Jul 31, 2015
d4b0850
Added camera logger and picture taking.
Razican Jul 31, 2015
5486f34
Changed configuration script to new bug tracker.
Razican Jul 31, 2015
914dfba
Added state recovery
Razican Aug 2, 2015
be69666
Much progress with batteries and camera. Still SMSs failing.
Razican Aug 6, 2015
ab7e993
Added sleep in serial close for stability.
Razican Aug 7, 2015
3668126
Fixed build
Razican Aug 7, 2015
233ef1a
Added USB powering mode
Razican Aug 8, 2015
0b56682
Fixed GSM serial
Razican Aug 8, 2015
d85618c
Better logging and trying to fix SMSs (#20).
Razican Aug 8, 2015
5376f8d
Fixed logger call
Razican Aug 8, 2015
1bf26fa
Some polishing.
Razican Aug 8, 2015
a4d9aa9
Better logging in read_only GSM command
Razican Aug 8, 2015
d2e6338
Fixed syntax error
Razican Aug 8, 2015
59079a7
Fixed GSM on/off commands
Razican Aug 8, 2015
11a5c37
(I hope finally) fixed GSM on/off switch
Razican Aug 8, 2015
2f96735
Re-enabled camera
Razican Aug 19, 2015
74aef9a
Refactored GSM code
Razican Aug 19, 2015
dfa0dbd
Fixed some code
Razican Aug 19, 2015
21b2e1c
Fixed initialization
Razican Aug 19, 2015
f3ab6fe
Fixed percentage log
Razican Aug 19, 2015
88dfe33
This should implement #31
Razican Aug 20, 2015
a041c24
Fixed GPS serial initialization
Razican Aug 20, 2015
61ef381
If GPS was of it would try to configure it giving segmentation fault
Razican Aug 20, 2015
5dc40ea
Did not create logger for GPS serial
Razican Aug 20, 2015
8c28dca
Still shows segmentation fault
Razican Aug 20, 2015
d6ff602
Fixed segmentation fault (I hope so, at least)
Razican Aug 20, 2015
cad5b6d
Added second try on empty commands
Razican Aug 20, 2015
e33680e
Better logger output on batteries
Razican Aug 20, 2015
5c3ca3e
Refactorized serial threads. Now better lose coupling
Razican Aug 22, 2015
0464de7
Fixed GPS thread
Razican Aug 24, 2015
bbb4cc8
More default serial timeout and added more tries on GSM initialization.
Razican Aug 24, 2015
f84832d
Added echo to GSM
Razican Aug 24, 2015
505996a
Fixed GSM initialization
Razican Aug 24, 2015
f0c0197
Added debug information to SMS failure
Razican Aug 24, 2015
0d92404
Fixed build
Razican Aug 24, 2015
5759e65
Finished #33
Razican Aug 24, 2015
1409556
Eat message echo
Razican Aug 24, 2015
1e38554
Trying to fix SMS sending (#20)
Razican Aug 24, 2015
91a0b4b
Fixing SMS sending
Razican Aug 24, 2015
46c9769
Trying to send Ctrl+Z properly
Razican Aug 24, 2015
3556c6a
There was not enough timeout
Razican Aug 25, 2015
1a02eed
More realistic descent times, trying to debug connectivity issues.
Razican Aug 25, 2015
688dbb3
Fixed connectivity issues (I hope)
Razican Aug 25, 2015
7658459
Fixing small issues and better point detection
Razican Aug 25, 2015
808a90a
No more space trimming
Razican Aug 25, 2015
44048bb
Fixed infinite loop
Razican Aug 25, 2015
23b9ee2
Fixed comparison
Razican Aug 25, 2015
9287cc4
Fixing battery check
Razican Aug 25, 2015
8be7328
Starting with #32
Razican Aug 25, 2015
fb78118
Major logic refactoring
Razican Aug 26, 2015
e2c68b7
Close #41
Razican Aug 26, 2015
5062bc8
Close #42.
Razican Aug 26, 2015
2a543a7
Fixed some compiling issues
Razican Aug 26, 2015
3bd49e1
Better logger messages in directory creation
Razican Aug 26, 2015
54ea7b6
Closed #38 and #43.
Razican Aug 26, 2015
6e489da
Fixed GPS setting month incorrectly
Razican Aug 26, 2015
7e93468
Added small debug message for simulations
Razican Aug 26, 2015
67056ef
Updated script to real weight
Razican Aug 28, 2015
97988c5
Added startup script.
Razican Aug 29, 2015
b443f30
Fixed #39
Razican Aug 29, 2015
2ca23ac
Started with #40. Still many cases to to.
Razican Aug 29, 2015
9154763
Fixed #36
Razican Sep 2, 2015
2c5f326
Implemented #28. Still testing needed
Razican Sep 2, 2015
5c65ba7
Better README. Fixes #46
Razican Sep 2, 2015
5109d54
New system thread.
Razican Sep 4, 2015
b9c3ded
Should implement #49.
Razican Sep 5, 2015
6ea3ab2
Some files wew missing
Razican Sep 5, 2015
6d47a36
Fixed small compiling warning
Razican Sep 5, 2015
66234ba
Safe mode finished.
Razican Sep 5, 2015
8cdbdf0
Enabled camera recording in safe mode
Razican Sep 5, 2015
5293362
That's all folks!
Razican Sep 5, 2015
c96f22d
Small debug log added
Razican Sep 5, 2015
90961bf
Bumped version to 1.0-rc1
Razican Sep 5, 2015
64c4346
Fixed small compilation issue
Razican Sep 8, 2015
790f99a
Added no power off mode
Razican Sep 8, 2015
36b1d6d
Some fixes, might be the solution to #51.
Razican Sep 8, 2015
28508d8
More fixes.
Razican Sep 8, 2015
5214939
Fixed #55
Razican Sep 8, 2015
76e4410
No need for that delete, using RAII.
Razican Sep 8, 2015
a1f2322
Fixed small issues when shutting the app down.
Razican Sep 8, 2015
c9411f5
Fixed small issue in safe mode and better exit.
Razican Sep 8, 2015
c8f35ba
Fixed possible log deletion.
Razican Sep 8, 2015
55a909f
Fixed recovery mode: WiringPi was not initialized
Razican Sep 8, 2015
3c9ba04
Trying to fix multiline SMSs (#56)
Razican Sep 10, 2015
c472453
Fixed #56
Razican Sep 10, 2015
1e829e6
Added number of satellites to SMSs.
Razican Sep 10, 2015
b31aba0
Small styling change to camera
Razican Sep 10, 2015
b3ba102
Small polishing
Razican Sep 10, 2015
e04fc50
Small polishing
Razican Sep 11, 2015
a391a99
Merge branch 'release/1.0-rc1'
Razican Sep 11, 2015
1c98ccd
Merge branch 'release/1.0-rc1' into develop
Razican Sep 11, 2015
c42b399
Fixed small build issue
Razican Sep 15, 2015
56249db
Small fixes in SMSs
Razican Sep 15, 2015
e43922f
Fixed #39
Razican Sep 15, 2015
8ac34a9
Beter syntax on SMS sending.
Razican Sep 15, 2015
696415b
Trying to fix GSM localization.
Razican Sep 15, 2015
fa3edda
Fixed #58 and small recovery mode fix
Razican Sep 15, 2015
5333cbe
Smaall cleanups and fixes
Razican Sep 19, 2015
d1fdd93
Fixed build error
Razican Sep 19, 2015
d8a5d5a
Added validity check in GPS frames
Razican Sep 19, 2015
10f5a5a
Fixed SMSs
Razican Sep 19, 2015
6ba1721
Added double battery check on initialization
Razican Sep 19, 2015
557f619
Added second attempt in launch SMS
Razican Sep 19, 2015
ba1c0fd
Added second battery checks
Razican Sep 19, 2015
1d474cd
Bumped version number
Razican Sep 26, 2015
0d752b3
Merge branch 'release/1.0'
Razican Sep 26, 2015
d8ea111
Merge branch 'master' into feature/MCP3424
Razican Oct 27, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ openstratos
openstratosRoot
utesting
Makefile
data
config.h

# http://www.gnu.org/software/automake

Expand All @@ -48,7 +50,8 @@ Makefile
.deps/
.dirstamp
*~
config.h

# Eclipse files
.project
.cproject
.cproject
19 changes: 13 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
language: cpp
compiler: gcc
sudo: required

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- autoconf
- automake
- m4
- gcc-4.9
- g++-4.9

before_install:
- git submodule update --init --recursive > /dev/null
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- export CXX="g++-4.9"

install:
- sudo apt-get install -qq autoconf automake m4 gcc-4.9 g++-4.9 > /dev/null
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 90
- "bash -ex ./install-wiringpi.sh"

script:
Expand All @@ -26,8 +35,6 @@ notifications:
email:
recipients:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
on_success: change
on_failure: always
25 changes: 25 additions & 0 deletions DCO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(1) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(2) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(3) The contribution was provided directly to me by some other
person who certified (1), (2) or (3) and I have not modified
it.

(4) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
14 changes: 5 additions & 9 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
bin_PROGRAMS = openstratos
openstratos_SOURCES = openstratos.cc camera/Camera.cc gps/GPS.cc serial/Serial.cc battery/Battery.cc temperature/Temperature.cc
openstratos_LDADD = -lwiringPi
openstratos_CPPFLAGS = -std=c++11 -Wno-unused-result
openstratos_SOURCES = openstratos.cc utils.cc threads.cc camera/Camera.cc gps/GPS.cc serial/Serial.cc logger/Logger.cc gsm/GSM.cc adc/MCP3424.cc adc/ADC.cc
openstratos_CPPFLAGS = -std=c++14

EXTRA_PROGRAMS = openstratosRoot utesting
openstratosRoot_SOURCES = openstratos-root.cc camera/Camera.cc gps/GPS.cc serial/Serial.cc battery/Battery.cc temperature/Temperature.cc
openstratosRoot_CPPFLAGS = -std=c++11 -Wno-unused-result

utesting_SOURCES = testing/testing.cc camera/Camera.cc gps/GPS.cc serial/Serial.cc battery/Battery.cc temperature/Temperature.cc
utesting_CPPFLAGS = -std=c++11 -Itesting/bandit -Wno-unused-result -DOS_TESTING
EXTRA_PROGRAMS = utesting
utesting_SOURCES = testing/testing.cc camera/Camera.cc gps/GPS.cc serial/Serial.cc logger/Logger.cc
utesting_CPPFLAGS = -std=c++14 -Itesting/bandit -Wno-unused-result -DOS_TESTING
120 changes: 119 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,122 @@

[![Build Status](https://travis-ci.org/OpenStratos/server.svg?branch=develop)](https://travis-ci.org/OpenStratos/server)

Server implemented in C++11. It will be in charge of the management of the balloon.
Server implemented in C++14. It will be in charge of the management of the balloon. It will
communicate via SMS to the provided phone. It will initialize all needed components, track and log
position and software messages, detect launch, burst and landing and send the landing position via
SMS.

## Requirements ##

The software needs a working instalation of WiringPi and a RaspiCam for the tests. It will perform
some basic tests if no Raspberry Pi is being used. It works with Adafruit Fona module, even though
it should work with other GSM modules. It also uses the Adafruit Ultimate GPS module. The following
software is needed to compile OpenStratos (apart from the WiringPi library):

* build-essential
* g++
* m4
* automake
* autoconf

## Compiling ##

For compilation, a *build.sh* script is provided, that should be run as is. It will compile the
tests of OpenStratos and run them. After that, the main program can be compiled using ```make```.
Optional configuration arguments can be passed. The first optional configuration argument is the
*NO_SMS* flag. This prevents actual SMSs being sent, even if they are simulated. This way no charges
will be applied. For using this argument the directory should be cleaned with ```make clean``` and
then pass the *NO_SMS* flag to the configure script:

```
./configure CPPFLAGS="-DNO_SMS"
```

After that the usual ```make``` will compile the software. Note that the test do not send SMSs. The software itself comes with two built-in simulation modes:

### Normal Simulation ###

In this mode, a simple simulation is made, with a length of about 45 minutes. It will run through
all the main stages of the program. For using this mode the directory should be cleaned with
```make clean``` and then pass the *SIM* flag to the configure script:

```
./configure CPPFLAGS="-DSIM"
```

It can be combined with the *NO_SMS* flag:

```
./configure CPPFLAGS="-DSIM -DNO_SMS"
```

After that, the software can be compiled using ```make```.

### Realistic Simulation ###

In this mode, a complete realistic simulation is made, that will last for about 5 hours. It will
realistically simulate the times in a 35 km height balloon. It will be similar to the normal
simulation, the only change will be in the timing. For using this mode the directory should be
cleaned with ```make clean``` and then pass the *REAL_SIM* flag to the configure script:

```
./configure CPPFLAGS="-DREAL_SIM"
```

It can be combined with the *NO_SMS* flag:

```
./configure CPPFLAGS="-DREAL_SIM -DNO_SMS"
```

After that, the software can be compiled using ```make```. The result of combining the two
simulation flags is undetermined. They should not be combined.

### Debug Mode ###

The software has a small debug mode, that prints from *stdio* some logs that occur before the log
file is created. It also enables serial logging, that will log everything that happens in the
serial. This has a moderate overhead and should not be used in production. GSM and GPS loggers log everythong they send and receive. This is only needed to debug if something goes wrong with the
serial. For using this mode the directory should be cleaned with ```make clean``` and then pass the
*DEBUG* flag to the configure script:

```
./configure CPPFLAGS="-DDEBUG"
```

It can be combined with the *NO_SMS* flag or/and one of the simulation flags:

```
./configure CPPFLAGS="-DREAL_SIM -DNO_SMS -DDEBUG"
./configure CPPFLAGS="-DSIM -DDEBUG"
./configure CPPFLAGS="-DNO_SMS -DDEBUG"
```

### No power off mode ###

For some testing there is no need to reboot or shut down the system in failures. For this, the
software provides the no power off mode, that will prevent the software from shutting the
Raspberry Pi down. For using this mode the directory should be cleaned with ```make clean``` and
then pass the *NO_POWER_OFF* flag to the configure script:

```
./configure CPPFLAGS="-DNO_POWER_OFF"
```

It can be combined with the *NO_SMS* flag, the *DEBUG* flag or/and one of the simulation flags:

```
./configure CPPFLAGS="-DREAL_SIM -DNO_SMS -DDEBUG -DNO_POWER_OFF"
./configure CPPFLAGS="-DSIM -DDEBUG -DNO_POWER_OFF"
./configure CPPFLAGS="-DNO_SMS -DDEBUG -DNO_POWER_OFF"

## License ##

This software is licensed under the GNU General Public License version 3. You can use, copy, modify
the software as long as all the derivative work is published under the same license. A copy of the license can be found in the *[COPYING](COPYING)* file of the repository where a detailed explanation
of the copying rights can be found.

## Contributing guidelines ##

The guidelines to contribute to this repository can be found in the
[contribution guidelines](contributing.md) file of the repository.
1 change: 1 addition & 0 deletions adc/ADC.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "adc/ADC.h"
4 changes: 4 additions & 0 deletions adc/ADC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef ADC_ADC_H_
#define ADC_ADC_H_

#endif
11 changes: 11 additions & 0 deletions adc/MCP3424.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "adc/MCP3424.h"
#include <wiringPiI2C.h>

using namespace os;

MCP3424::MCP3424(int i2c_address, int gain, int res)
{
this->gain = gain;
this->res = res;
this->fd = wiringPiI2CSetup(i2c_address);
}
24 changes: 24 additions & 0 deletions adc/MCP3424.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef ADC_MCP3424_H_
#define ADC_MCP3424_H_

namespace os {

class MCP3424
{
private:
int fd;
int gain;
int res;

inline int get_divisor() {return 1 << (this->gain + 2*this->res);}

public:
MCP3424(int i2c_address, int gain, int res);
MCP3424(MCP3424& copy) = delete;
~MCP3424() = default;

double read_channel(int channel);
};
}

#endif // ADC_MCP3424_H_
6 changes: 0 additions & 6 deletions autogen.sh

This file was deleted.

73 changes: 0 additions & 73 deletions battery/Battery.cc

This file was deleted.

34 changes: 0 additions & 34 deletions battery/Battery.h

This file was deleted.

Loading