Skip to content
This repository has been archived by the owner on May 9, 2019. It is now read-only.

Commit

Permalink
refs #17 Fix helios thermistor reading dataflow.
Browse files Browse the repository at this point in the history
Still freezes after printing twice.
  • Loading branch information
yoos committed Feb 10, 2015
1 parent 56b0e9d commit 6fab407
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/drivers/ublox_neo7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ GPSReading UBloxNEO7::readGPS() {
read(10); // TODO
//chprintf((BaseSequentialStream*)&SD4, "%10c", rxbuf.data());

char dbg_buf[16];
chsnprintf(dbg_buf, 12, "%12c", rxbuf.data());
chnWriteTimeout((BaseChannel*)&SD4, (uint8_t*)dbg_buf, 12, MS2ST(20));
//char dbg_buf[18];
//chsnprintf(dbg_buf, 12, "%12c", rxbuf.data());
//chnWriteTimeout((BaseChannel*)&SD4, (uint8_t*)dbg_buf, 12, MS2ST(20));

// Run parser
// TODO
Expand Down
3 changes: 3 additions & 0 deletions src/drivers/vishaytherm.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "drivers/vishaytherm.hpp"

#include "chprintf.h"
#include "unit_config.hpp"

void VishayTherm::init() {
Expand All @@ -10,5 +11,7 @@ ThermistorReading VishayTherm::readTherm() {

reading.celsius = 2.345f;

chprintf((BaseSequentialStream*)&SD4, "%f\r\n", reading.celsius);

return reading;
}
2 changes: 1 addition & 1 deletion src/estimator/world_estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ WorldEstimate WorldEstimator::update(const SensorReadingGroup& readings) {

if(worldMessageStream.ready()) {
protocol::message::log_message_t m;
sprintf(m.data, "world estimate test");
sprintf(m.data, "therm: %f", readings.therm->celsius);

worldMessageStream.publish(m);
}
Expand Down
11 changes: 8 additions & 3 deletions variants/platforms/aerial_v4/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ VishayTherm& Platform::get() {
}

template <>
ADCPlatform& Platform::get() {
static ADCPlatform adcPlatform;
return adcPlatform;
Thermistor& Platform::get() {
return get<VishayTherm>();
}

template <>
Expand All @@ -121,6 +120,12 @@ GPS& Platform::get() {
return get<UBloxNEO7>();
}

template <>
ADCPlatform& Platform::get() {
static ADCPlatform adcPlatform;
return adcPlatform;
}

template <>
I2CPlatform& Platform::get() {
static I2CPlatform i2cPlatform;
Expand Down
8 changes: 7 additions & 1 deletion variants/units/helios/unit_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "sensor/gyroscope.hpp"
#include "sensor/accelerometer.hpp"
#include "sensor/gps.hpp"
#include "sensor/thermistor.hpp"
#include "system/multirotor_vehicle_system.hpp"
#include "util/optional.hpp"
#include "variant/platform.hpp"
Expand Down Expand Up @@ -38,7 +39,12 @@ struct UnitData {
world(communicator),
attitude(communicator),
inputSource(communicator),
system(platform.get<Gyroscope>(), platform.get<Accelerometer>(), platform.get<GPS>(), std::experimental::nullopt, std::experimental::nullopt, world, attitude, inputSource, motorMapper, communicator) {
system(platform.get<Gyroscope>(),
platform.get<Accelerometer>(),
platform.get<GPS>(),
std::experimental::nullopt,
std::experimental::make_optional(&platform.get<Thermistor>()),
world, attitude, inputSource, motorMapper, communicator) {
}
};

Expand Down

0 comments on commit 6fab407

Please sign in to comment.