kopia lustrzana https://github.com/DL7AD/pecanpico9
Made tracking struct compatible to most recent decoder
rodzic
3008ff27fe
commit
a8441c508a
|
@ -270,7 +270,7 @@ void setModem2GFSK(gfsk_conf_t* conf) {
|
|||
Si4464_write(setup_data_rate, 7);
|
||||
|
||||
// Use 2GFSK from FIFO (PH)
|
||||
uint8_t use_2gfsk[] = {0x11, 0x20, 0x01, 0x00, 0x03};
|
||||
uint8_t use_2gfsk[] = {0x11, 0x20, 0x01, 0x00, 0x02};
|
||||
Si4464_write(use_2gfsk, 5);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ bool gps_receive_byte(uint8_t *data)
|
|||
return true;
|
||||
}
|
||||
#elif defined(UBLOX_USE_UART)
|
||||
uint8_t msg;
|
||||
if((msg = sdGetTimeout(&SD5, TIME_IMMEDIATE)) != MSG_TIMEOUT) {
|
||||
*data = msg;
|
||||
return true;
|
||||
|
|
|
@ -200,7 +200,7 @@ static void aquirePosition(trackPoint_t* tp, trackPoint_t* ltp, systime_t timeou
|
|||
|
||||
} else { // GPS communication error
|
||||
|
||||
GPS_Deinit();
|
||||
//GPS_Deinit();
|
||||
tp->gps_lock = GPS_ERROR;
|
||||
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ static void measureVoltage(trackPoint_t* tp)
|
|||
pac1720_get_avg(&tp->pac_vbat, &tp->pac_vsol, &tp->pac_pbat, &tp->pac_psol);
|
||||
}
|
||||
|
||||
static bool bme280_error;
|
||||
static uint8_t bme280_error;
|
||||
|
||||
static void getSensors(trackPoint_t* tp)
|
||||
{
|
||||
|
@ -241,14 +241,15 @@ static void getSensors(trackPoint_t* tp)
|
|||
tp->sen_i1_press = BME280_getPressure(&handle, 256);
|
||||
tp->sen_i1_hum = BME280_getHumidity(&handle);
|
||||
tp->sen_i1_temp = BME280_getTemperature(&handle);
|
||||
bme280_error = false;
|
||||
bme280_error = 0x0;
|
||||
} else { // No internal BME280 found
|
||||
TRACE_ERROR("TRAC > Internal BME280 not available");
|
||||
tp->sen_i1_press = 0;
|
||||
tp->sen_i1_hum = 0;
|
||||
tp->sen_i1_temp = 0;
|
||||
bme280_error = true;
|
||||
bme280_error = 0x1;
|
||||
}
|
||||
bme280_error |= 0x0A;
|
||||
|
||||
// Measure various temperature sensors
|
||||
tp->stm32_temp = stm32_get_temp();
|
||||
|
@ -259,7 +260,19 @@ static void getSensors(trackPoint_t* tp)
|
|||
}
|
||||
|
||||
static void setSystemStatus(trackPoint_t* tp) {
|
||||
// Set system errors
|
||||
|
||||
/*
|
||||
* Set system errors.
|
||||
*
|
||||
* Bit usage:
|
||||
* - 0:1 I2C status
|
||||
* - 2:2 GPS status
|
||||
* - 3:4 pac1720 status
|
||||
* - 5:7 OV5640 status
|
||||
* - 8:9 BMEi1 status (0 = OK, 1 = Fail, 2 = Not fitted)
|
||||
* - 10:11 BMEe1 status (0 = OK, 1 = Fail, 2 = Not fitted)
|
||||
* - 12:13 BMEe2 status (0 = OK, 1 = Fail, 2 = Not fitted)
|
||||
*/
|
||||
tp->sys_error = 0;
|
||||
|
||||
tp->sys_error |= (I2C_hasError() & 0x1) << 0;
|
||||
|
@ -267,9 +280,8 @@ static void setSystemStatus(trackPoint_t* tp) {
|
|||
tp->sys_error |= (pac1720_hasError() & 0x3) << 3;
|
||||
tp->sys_error |= (OV5640_hasError() & 0x7) << 5;
|
||||
|
||||
tp->sys_error |= (bme280_error & 0x1) << 8;
|
||||
tp->sys_error |= 0x1 << 9; // No external BME280 available (PP9a doesnt have external sensors, but PP10a has)
|
||||
tp->sys_error |= 0x1 << 10; // No external BME280 available (PP9a doesnt have external sensors, but PP10a has)
|
||||
tp->sys_error |= (bme280_error & BME_ALL_STATUS_MASK)
|
||||
<< BME_ALL_STATUS_SHIFT;
|
||||
|
||||
// Set system time
|
||||
tp->sys_time = ST2S(chVTGetSystemTimeX());
|
||||
|
|
|
@ -5,6 +5,26 @@
|
|||
#include "hal.h"
|
||||
#include "ptime.h"
|
||||
|
||||
|
||||
#define BME_STATUS_BITS 2
|
||||
#define BME_STATUS_MASK 0x3
|
||||
#define BME_OK_VALUE 0x0
|
||||
#define BME_FAIL_VALUE 0x1
|
||||
#define BME_NOT_FITTED_VALUE 0x2
|
||||
|
||||
#define BME_ALL_STATUS_MASK 0x3F
|
||||
#define BME_ALL_STATUS_SHIFT 8
|
||||
|
||||
#define BMEI1_STATUS_SHIFT BME_ALL_STATUS_SHIFT
|
||||
#define BMEI1_STATUS_MASK (BME_STATUS_MASK << BMEI1_STATUS_SHIFT)
|
||||
|
||||
#define BMEE1_STATUS_SHIFT BMEI1_STATUS_SHIFT + BME_STATUS_BITS
|
||||
#define BMEE1_STATUS_MASK (BME_STATUS_MASK << BMEE1_STATUS_SHIFT)
|
||||
|
||||
#define BMEE2_STATUS_SHIFT BMEI1_STATUS_SHIFT + BME_STATUS)BITS
|
||||
#define BMEE2_STATUS_MASK (BME_STATUS_MASK << BMEE2_STATUS_SHIFT)
|
||||
|
||||
|
||||
typedef enum {
|
||||
GPS_LOCKED1, // The GPS is locked, the GPS has been switched off
|
||||
GPS_LOCKED2, // The GPS is locked, the GPS has been kept switched on
|
||||
|
@ -60,14 +80,18 @@ typedef struct {
|
|||
|
||||
uint32_t sys_time; // System time (in seconds)
|
||||
uint32_t sys_error; // System error flags
|
||||
// Bit 0: I2C_I EVA7M
|
||||
// Bit 1: I2C_I PAC1720
|
||||
// Bit 2: I2C_I OV5640
|
||||
// Bit 3: I2C_I BME280_I1
|
||||
// Bit 4: I2C_E BME280_E1
|
||||
// Bit 5: I2C_E BME280_E2
|
||||
// Bit 6: UART EVA7M
|
||||
// Bit 7: <reserved>
|
||||
/*
|
||||
* Set system errors.
|
||||
*
|
||||
* Bit usage:
|
||||
* - 0:1 I2C status
|
||||
* - 2:2 GPS status
|
||||
* - 3:4 pac1720 status
|
||||
* - 5:7 OV5640 status
|
||||
* - 8:9 BMEi1 status (0 = OK, 1 = Fail, 2 = Not fitted)
|
||||
* - 10:11 BMEe1 status (0 = OK, 1 = Fail, 2 = Not fitted)
|
||||
* - 12:13 BMEe2 status (0 = OK, 1 = Fail, 2 = Not fitted)
|
||||
*/
|
||||
} trackPoint_t;
|
||||
|
||||
void waitForNewTrackPoint(void);
|
||||
|
|
|
@ -46,7 +46,7 @@ typedef struct {
|
|||
telemetry_t tel[5]; // Telemetry types
|
||||
bool tel_enc; // Transmit telemetry encoding information
|
||||
uint16_t tel_enc_cycle; // Telemetry encoding cycle in seconds
|
||||
char tel_comment[32]; // Telemetry comment
|
||||
char tel_comment[64]; // Telemetry comment
|
||||
} aprs_conf_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
Ładowanie…
Reference in New Issue