Reorganize to access more information from OLED status pages

pull/5/head
Pawel Jalocha 2019-05-07 16:08:22 +01:00
rodzic 5e548ef42b
commit 788312c307
10 zmienionych plików z 106 dodań i 33 usunięć

Wyświetl plik

@ -1,3 +1,6 @@
#ifndef __BME280_H__
#define __BME280_H__
#include <stdint.h>
#include <string.h>
#include <math.h>
@ -122,3 +125,4 @@ class BME280: public BMP280
} ;
#endif // __BME280_H__

Wyświetl plik

@ -1,3 +1,6 @@
#ifndef __BMP180_H__
#define __BMP180_H__
#include <stdint.h>
#include <string.h>
#include <math.h>
@ -144,3 +147,5 @@ class BMP180
Pressure += (X1+X2+3791)>>4; }
} ;
#endif // __BMP180_H__

Wyświetl plik

@ -1,3 +1,6 @@
#ifndef __BMP280_H__
#define __BMP280_H__
#include <stdint.h>
#include <string.h>
#include <math.h>
@ -21,7 +24,7 @@ class BMP280
static const uint8_t REG_PRESS_LSB = 0xF8; // Pressure result: LSB
static const uint8_t REG_PRESS_XLSB = 0xF9; // Pressure result: more LSB
static const uint8_t REG_TEMP = 0xFA; // Temperature result:
static const uint8_t REG_TEMP_ = 0xFA; // Temperature result:
static const uint8_t REG_TEMP_MSB = 0xFA; // Temperature result: MSB
static const uint8_t REG_TEMP_LSB = 0xFB; // Temperature result: LSB
static const uint8_t REG_TEMP_XLSB = 0xFC; // Temperature result: more LSB
@ -113,7 +116,7 @@ class BMP280
uint8_t ReadRawTemp(void) // read raw temperature ADC conversion result
{ RawTemp=0;
Error=I2C_Read(Bus, ADDR, REG_TEMP, (uint8_t *)(&RawTemp), 3); if(Error) return Error;
Error=I2C_Read(Bus, ADDR, REG_TEMP_, (uint8_t *)(&RawTemp), 3); if(Error) return Error;
RawTemp = ((RawTemp<<16)&0xFF0000) | (RawTemp&0x00FF00) | ((RawTemp>>16)&0x0000FF);
RawTemp>>=4;
return 0; }
@ -154,3 +157,5 @@ class BMP280
}
} ;
#endif // __BMP280_H__

Wyświetl plik

@ -10,6 +10,7 @@
#include "hal.h"
#include "rf.h"
#include "sens.h"
#include "ctrl.h"
#include "log.h"
@ -313,6 +314,43 @@ void OLED_DrawSystem(u8g2_t *OLED)
Line[Len]=0;
u8g2_DrawStr(OLED, 0, 12, Line);
Len=0;
#ifdef WITH_RFM69
Len+=Format_String(Line+Len, "RFM69 v"); // Type of RF chip used
if(isTxTypeHW()) Line[Len++]='H';
Line[Len++]='W';
#endif
#ifdef WITH_RFM95
Len+=Format_String(Line+Len, "RFM95 v");
#endif
#ifdef WITH_SX1272
Len+=Format_String(Line+Len, "SX1272 v");
#endif
Len+=Format_Hex(Line+Len, TRX.chipVer);
Line[Len++]=' ';
Len+=Format_SignDec(Line+Len, (int16_t)TRX.chipTemp);
Line[Len++]=0xB0;
Line[Len++]='C';
Line[Len]=0;
u8g2_DrawStr(OLED, 0, 24, Line);
Len=0;
#ifdef WITH_BMP180
Len+=Format_String(Line+Len, "BMP180 0x");
#endif
#ifdef WITH_BMP280
Len+=Format_String(Line+Len, "BMP280 0x");
#endif
#ifdef WITH_BME280
Len+=Format_String(Line+Len, "BME280 0x");
#endif
#ifdef WITH_MS5607
Len+=Format_String(Line+Len, "MS5607 0x");
#endif
Len+=Format_Hex(Line+Len, Baro.ADDR);
Line[Len]=0;
u8g2_DrawStr(OLED, 0, 36, Line);
#ifdef WITH_SD
Len=0;
Len += Format_String(Line+Len, "SD ");

Wyświetl plik

@ -19,7 +19,7 @@ static const uint8_t *OGN_SYNC = OGN1_SYNC;
static const uint8_t *OGN_SYNC = OGN2_SYNC;
#endif
static RFM_TRX TRX; // radio transceiver
RFM_TRX TRX; // radio transceiver
uint8_t RX_AverRSSI; // [-0.5dBm] average RSSI
int8_t RF_Temp; // [degC] temperature of the RF chip: uncalibrated
@ -239,10 +239,10 @@ extern "C"
#ifdef WITH_RFM69
TRX.TriggerTemp(); // trigger RF chip temperature readout
vTaskDelay(1); // while(TRX.RunningTemp()) taskYIELD(); // wait for conversion to be ready
RF_Temp= 165-TRX.ReadTemp(); // [degC] read RF chip temperature
RF_Temp= TRX.ReadTemp(); // [degC] read RF chip temperature
#endif
#ifdef WITH_RFM95
RF_Temp= 15-TRX.ReadTemp(); // [degC] read RF chip temperature
RF_Temp= TRX.ReadTemp(); // [degC] read RF chip temperature
#endif
RF_Temp+=Parameters.RFchipTempCorr;
// Note: on RFM95 temperature sens does not work in STANDBY

Wyświetl plik

@ -1,3 +1,6 @@
#ifndef __RF_H__
#define __RF_H__
#include <stdint.h>
#include "hal.h"
@ -15,6 +18,7 @@
extern uint8_t RX_OGN_Packets; // [packets] counts received packets
extern uint8_t RX_AverRSSI; // [-0.5dBm] average RSSI
extern int8_t RF_Temp; // [degC] temperature of the RF chip: uncalibrated
extern RFM_TRX TRX; // RF transceiver
extern FreqPlan RF_FreqPlan; // frequency hopping pattern calculator
extern uint16_t TX_Credit; // counts transmitted packets vs. time to avoid using more than 1% of the time
extern uint16_t RX_OGN_Count64; // counts received packets for the last 64 seconds
@ -28,3 +32,4 @@
#endif
void vTaskRF(void* pvParameters);
#endif // __RF_H__

Wyświetl plik

@ -1,3 +1,8 @@
#ifndef __RFM_H__
#define __RFM_H__
#include <stdint.h>
// -----------------------------------------------------------------------------------------------------------------------
#include "config.h"
@ -140,6 +145,9 @@ class RFM_RxPktData // packet received by the RF chip
class RFM_TRX
{ public: // hardware access functions
uint8_t chipVer; // [] version ID read from the RF chip
int8_t chipTemp; // [degC] temperature read from the RF chip
#ifdef USE_BLOCK_SPI // SPI transfers in blocks, implicit control of the SPI-select
void (*TransferBlock)(uint8_t *Data, uint8_t Len);
static const size_t MaxBlockLen = 64;
@ -464,7 +472,7 @@ class RFM_TRX
#endif
uint8_t ReadVersion(void) { return ReadByte(REG_VERSION); } // normally returns: 0x24
uint8_t ReadVersion(void) { chipVer=ReadByte(REG_VERSION); return chipVer; } // 0x24 for RFM69 or 0x12 for RFM95
#ifdef WITH_RFM69
void TriggerRSSI(void) { WriteByte(0x01, REG_RSSICONFIG); } // trigger measurement
@ -475,11 +483,10 @@ class RFM_TRX
#ifdef WITH_RFM69
void TriggerTemp(void) { WriteByte(0x08, REG_TEMP1); } // trigger measurement
uint8_t RunningTemp(void) { return ReadByte(REG_TEMP1) & 0x04; } // still running ?
uint8_t ReadTemp(void) { return ReadByte(REG_TEMP2); } // read value: -1 deg/LSB
int8_t ReadTemp(void) { chipTemp=165-ReadByte(REG_TEMP2); return chipTemp; } // [deg]
#endif
// #ifdef WITH_RFM95
#if defined(WITH_RFM95) || defined(WITH_SX1272)
uint8_t ReadTemp(void) { return ReadByte(REG_TEMP); } // read value: -1 deg/LSB
int8_t ReadTemp(void) { chipTemp = 15-ReadByte(REG_TEMP); return chipTemp; } // [degC]
#endif
/*
void Dump(uint8_t EndAddr=0x20)
@ -491,4 +498,5 @@ class RFM_TRX
*/
} ;
#endif // __RFM_H__

Wyświetl plik

@ -13,22 +13,6 @@
#if defined(WITH_BMP180) || defined(WITH_BMP280) || defined(WITH_MS5607) || defined(WITH_BME280)
#ifdef WITH_BMP180
#include "bmp180.h"
#endif
#ifdef WITH_BMP280
#include "bmp280.h"
#endif
#ifdef WITH_BME280
#include "bme280.h"
#endif
#ifdef WITH_MS5607
#include "ms5607.h"
#endif
#include "atmosphere.h"
#include "slope.h"
#include "lowpass2.h"
@ -60,19 +44,19 @@ void VarioSound(int32_t ClimbRate)
#endif // WITH_BEEPER
#ifdef WITH_BMP180
static BMP180 Baro; // BMP180 barometer sensor
BMP180 Baro; // BMP180 barometer sensor
#endif
#ifdef WITH_BMP280
static BMP280 Baro; // BMP280 barometer sensor
BMP280 Baro; // BMP280 barometer sensor
#endif
#ifdef WITH_BME280
static BME280 Baro; // BMP280 barometer sensor with humidity sensor
BME280 Baro; // BMP280 barometer sensor with humidity sensor
#endif
#ifdef WITH_MS5607
static MS5607 Baro; // BMP280 barometer sensor
MS5607 Baro; // BMP280 barometer sensor
#endif
static uint32_t AverPress; // [ Pa] summed Pressure over several readouts

Wyświetl plik

@ -1,6 +1,30 @@
#ifndef __SENS_H__
#define __SENS_H__
#ifdef WITH_BMP180
#include "bmp180.h"
extern BMP180 Baro; // BMP180 barometer sensor
#endif
#ifdef WITH_BMP280
#include "bmp280.h"
extern BMP280 Baro; // BMP280 barometer sensor
#endif
#ifdef WITH_BME280
#include "bme280.h"
extern BME280 Baro; // BMP280 barometer sensor with humidity sensor
#endif
#ifdef WITH_MS5607
#include "ms5607.h"
extern MS5607 Baro; // BMP280 barometer sensor
#endif
#ifdef __cplusplus
extern "C"
#endif
void vTaskSENS(void* pvParameters);
#endif // __SENS_H__

Wyświetl plik

@ -12,8 +12,8 @@ License: Revised BSD License, see LICENSE.TXT file include in the project
Maintainer: Miguel Luis and Gregory Cristian
*/
#ifndef __SX1276_REGS_FSK_H__
#define __SX1276_REGS_FSK_H__
#ifndef __SX1276_H__
#define __SX1276_H__
/*!
* ============================================================================
@ -1125,7 +1125,7 @@ Maintainer: Miguel Luis and Gregory Cristian
#define RF_PLL_BANDWIDTH_225 0x80
#define RF_PLL_BANDWIDTH_300 0xC0 // Default
#endif // __SX1276_REGS_FSK_H__
#endif // __SX1276_H__