compiles successfully
This commit is contained in:
parent
48cb6cf304
commit
87b6e3fbde
@ -4,7 +4,7 @@
|
||||
/**********************************************************************/
|
||||
|
||||
#ifndef HF_PWR_DEFAULT_LOAD
|
||||
#define HF_PWR_DEDAULT_LOAD 50.0
|
||||
#define HF_PWR_DEFAULT_LOAD 50.0
|
||||
#endif
|
||||
|
||||
#ifndef HF_VSWR_MAX_REPORTED
|
||||
@ -120,7 +120,7 @@ namespace HF {
|
||||
* @return Voltage Standing Wave Ratio (VSWR). This is calculated
|
||||
* as VSWR = (Vfwd + Vrev) / (Vfwd - Vrev).
|
||||
*/
|
||||
float VSWR(float Vfwd, float Vrev, float VSWRmax = vswrMaxReported) {
|
||||
inline float VSWR(float Vfwd, float Vrev, float VSWRmax = vswrMaxReported) {
|
||||
if (Vfwd - Vrev == 0.0) {
|
||||
return VSWRmax;
|
||||
} else {
|
||||
|
@ -1,5 +1,41 @@
|
||||
#include "Nextion.h"
|
||||
|
||||
char L_nowdisp = -1; //Sended nowdisp
|
||||
char L_vfoActive; //vfoActive
|
||||
unsigned long L_vfoCurr; //vfoA
|
||||
byte L_vfoCurr_mode; //vfoA_mode
|
||||
unsigned long L_vfoA; //vfoA
|
||||
byte L_vfoA_mode; //vfoA_mode
|
||||
unsigned long L_vfoB; //vfoB
|
||||
byte L_vfoB_mode; //vfoB_mode
|
||||
char L_ritOn;
|
||||
unsigned long L_ritTxFrequency; //ritTxFrequency
|
||||
char L_inTx;
|
||||
byte L_isDialLock; //byte isDialLock
|
||||
byte L_Split; //isTxType
|
||||
byte L_TXStop; //isTxType
|
||||
byte L_tuneStepIndex; //byte tuneStepIndex
|
||||
byte L_scaledSMeter; //scaledSMeter
|
||||
unsigned long L_sideTone; //sideTone
|
||||
byte L_cwKeyType; //L_cwKeyType 0: straight, 1 : iambica, 2: iambicb
|
||||
unsigned int L_cwSpeed; //cwSpeed
|
||||
byte L_cwDelayTime; //cwDelayTime
|
||||
byte L_delayBeforeCWStartTime; //byte delayBeforeCWStartTime
|
||||
byte L_attLevel;
|
||||
byte L_isIFShift; //1 = ifShift, 2 extend
|
||||
int L_ifShiftValue;
|
||||
byte L_sdrModeOn;
|
||||
byte scaledSMeter = 0;
|
||||
float calcVSWR = 0.0;
|
||||
float L_calcVSWR = 0.0;
|
||||
byte scaledVSWR = 0;
|
||||
byte L_scaledVSWR = 0;
|
||||
int fwdPower = 0;
|
||||
int L_fwdPower = 0;
|
||||
int revPower = 0;
|
||||
int L_revPower = 0;
|
||||
|
||||
|
||||
//Control must have prefix 'v' or 's'
|
||||
char softSTRHeader[11] = {'p', 'm', '.', 's', '0', '.', 't', 'x', 't', '=', '\"'};
|
||||
char softINTHeader[10] = {'p', 'm', '.', 'v', '0', '.', 'v', 'a', 'l', '='};
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef __Nextion_h__
|
||||
#define __Nextion_h__
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#define SWS_HEADER_CHAR_TYPE 'c' //1Byte Protocol Prefix
|
||||
#define SWS_HEADER_INT_TYPE 'v' //Numeric Protocol Prefex
|
||||
#define SWS_HEADER_STR_TYPE 's' //for TEXT Line compatiable Character LCD Control
|
||||
@ -15,72 +17,72 @@
|
||||
//===================================================================
|
||||
|
||||
#define CMD_NOW_DISP '0' //c0
|
||||
char L_nowdisp = -1; //Sended nowdisp
|
||||
extern char L_nowdisp; //Sended nowdisp
|
||||
|
||||
#define CMD_VFO_TYPE 'v' //cv
|
||||
char L_vfoActive; //vfoActive
|
||||
extern char L_vfoActive; //vfoActive
|
||||
|
||||
#define CMD_CURR_FREQ 'c' //vc
|
||||
unsigned long L_vfoCurr; //vfoA
|
||||
extern unsigned long L_vfoCurr; //vfoA
|
||||
#define CMD_CURR_MODE 'c' //cc
|
||||
byte L_vfoCurr_mode; //vfoA_mode
|
||||
extern byte L_vfoCurr_mode; //vfoA_mode
|
||||
|
||||
#define CMD_VFOA_FREQ 'a' //va
|
||||
unsigned long L_vfoA; //vfoA
|
||||
extern unsigned long L_vfoA; //vfoA
|
||||
#define CMD_VFOA_MODE 'a' //ca
|
||||
byte L_vfoA_mode; //vfoA_mode
|
||||
extern byte L_vfoA_mode; //vfoA_mode
|
||||
|
||||
#define CMD_VFOB_FREQ 'b' //vb
|
||||
unsigned long L_vfoB; //vfoB
|
||||
extern unsigned long L_vfoB; //vfoB
|
||||
#define CMD_VFOB_MODE 'b' //cb
|
||||
byte L_vfoB_mode; //vfoB_mode
|
||||
extern byte L_vfoB_mode; //vfoB_mode
|
||||
|
||||
#define CMD_IS_RIT 'r' //cr
|
||||
char L_ritOn;
|
||||
extern char L_ritOn;
|
||||
#define CMD_RIT_FREQ 'r' //vr
|
||||
unsigned long L_ritTxFrequency; //ritTxFrequency
|
||||
extern unsigned long L_ritTxFrequency; //ritTxFrequency
|
||||
|
||||
#define CMD_IS_TX 't' //ct
|
||||
char L_inTx;
|
||||
extern char L_inTx;
|
||||
|
||||
#define CMD_IS_DIALLOCK 'l' //cl
|
||||
byte L_isDialLock; //byte isDialLock
|
||||
extern byte L_isDialLock; //byte isDialLock
|
||||
|
||||
#define CMD_IS_SPLIT 's' //cs
|
||||
byte L_Split; //isTxType
|
||||
extern byte L_Split; //isTxType
|
||||
#define CMD_IS_TXSTOP 'x' //cx
|
||||
byte L_TXStop; //isTxType
|
||||
extern byte L_TXStop; //isTxType
|
||||
|
||||
#define CMD_TUNEINDEX 'n' //cn
|
||||
byte L_tuneStepIndex; //byte tuneStepIndex
|
||||
extern byte L_tuneStepIndex; //byte tuneStepIndex
|
||||
|
||||
#define CMD_SMETER 'p' //cs
|
||||
byte L_scaledSMeter; //scaledSMeter
|
||||
extern byte L_scaledSMeter; //scaledSMeter
|
||||
|
||||
#define CMD_SIDE_TONE 't' //vt
|
||||
unsigned long L_sideTone; //sideTone
|
||||
extern unsigned long L_sideTone; //sideTone
|
||||
#define CMD_KEY_TYPE 'k' //ck
|
||||
byte L_cwKeyType; //L_cwKeyType 0: straight, 1 : iambica, 2: iambicb
|
||||
extern byte L_cwKeyType; //L_cwKeyType 0: straight, 1 : iambica, 2: iambicb
|
||||
|
||||
#define CMD_CW_SPEED 's' //vs
|
||||
unsigned int L_cwSpeed; //cwSpeed
|
||||
extern unsigned int L_cwSpeed; //cwSpeed
|
||||
|
||||
#define CMD_CW_DELAY 'y' //vy
|
||||
byte L_cwDelayTime; //cwDelayTime
|
||||
extern byte L_cwDelayTime; //cwDelayTime
|
||||
|
||||
#define CMD_CW_STARTDELAY 'e' //ve
|
||||
byte L_delayBeforeCWStartTime; //byte delayBeforeCWStartTime
|
||||
extern byte L_delayBeforeCWStartTime; //byte delayBeforeCWStartTime
|
||||
|
||||
#define CMD_ATT_LEVEL 'f' //vf
|
||||
byte L_attLevel;
|
||||
extern byte L_attLevel;
|
||||
|
||||
byte L_isIFShift; //1 = ifShift, 2 extend
|
||||
extern byte L_isIFShift; //1 = ifShift, 2 extend
|
||||
#define CMD_IS_IFSHIFT 'i' //ci
|
||||
|
||||
int L_ifShiftValue;
|
||||
extern int L_ifShiftValue;
|
||||
#define CMD_IFSHIFT_VALUE 'i' //vi
|
||||
|
||||
byte L_sdrModeOn;
|
||||
extern byte L_sdrModeOn;
|
||||
#define CMD_SDR_MODE 'j' //cj
|
||||
|
||||
#define CMD_UBITX_INFO 'm' //cm Complete Send uBITX Information
|
||||
@ -96,19 +98,19 @@ byte L_sdrModeOn;
|
||||
#define CMD_AR_TUNE5 '5' //v5
|
||||
|
||||
//int idleStep = 0;
|
||||
byte scaledSMeter = 0;
|
||||
extern byte scaledSMeter;
|
||||
|
||||
float calcVSWR = 0.0;
|
||||
float L_calcVSWR = 0.0;
|
||||
extern float calcVSWR;
|
||||
extern float L_calcVSWR;
|
||||
|
||||
byte scaledVSWR = 0;
|
||||
byte L_scaledVSWR = 0;
|
||||
extern byte scaledVSWR;
|
||||
extern byte L_scaledVSWR;
|
||||
|
||||
int fwdPower = 0;
|
||||
int L_fwdPower = 0;
|
||||
extern int fwdPower;
|
||||
extern int L_fwdPower;
|
||||
|
||||
int revPower = 0;
|
||||
int L_revPower = 0;
|
||||
extern int revPower;
|
||||
extern int L_revPower;
|
||||
|
||||
void sendHeader(char varType, char varIndex);
|
||||
void sendCommandUL(char varIndex, unsigned long sendValue);
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include "Sensors.h"
|
||||
|
||||
UBitxSensors Sensors;
|
||||
|
||||
ADC adc;
|
||||
|
@ -100,7 +100,7 @@ const int uBitxSensorsSMeterPin = UBITX_SENSORS_S_METER_PIN;
|
||||
const int uBitxSensorsFwdPwrPin = UBITX_SENSORS_FWD_PWR_PIN;
|
||||
const int uBitxSensorsRevPwrPin = UBITX_SENSORS_REV_PWR_PIN;
|
||||
const int uBitxSensorsSupplyPin = UBITX_SENSORS_SUPPLY_PIN;
|
||||
const int uBitxSensorsAvgSamples = UBITX_SENSORS_AVERAGE_SAMPLES;
|
||||
const int uBitxSensorsAvgSamples = UBITX_SENSORS_AVG_SAMPLES;
|
||||
const float uBitxSensorsSMeterR1 = UBITX_SENSORS_S_METER_R1;
|
||||
const float uBitxSensorsSMeterR2 = UBITX_SENSORS_S_METER_R2;
|
||||
const float uBitxSensorsFwdPwrR1 = UBITX_SENSORS_FWD_PWR_R1;
|
||||
@ -121,9 +121,12 @@ const int uBitxSensorsSMeterValues[] = {
|
||||
UBITX_SENSORS_S_METER_LVL7,
|
||||
UBITX_SENSORS_S_METER_LVL8
|
||||
};
|
||||
|
||||
const int uBitxSensorsSMeterLevels = sizeof(uBitxSensorsSMeterValues) /
|
||||
sizeof(uBitxSensorsSMeterValues[0]);
|
||||
|
||||
extern ADC adc;
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
/*!
|
||||
@ -146,7 +149,7 @@ class TrailingAverage {
|
||||
current(0),
|
||||
divisor(T(N))
|
||||
{
|
||||
for (i = 0; i < N; i++) {
|
||||
for (int i = 0; i < N; i++) {
|
||||
data[i] = T(0);
|
||||
}
|
||||
}
|
||||
@ -223,10 +226,10 @@ class UBitxSensors {
|
||||
float fwdV = HF::adcIn(value.result_adc0);
|
||||
float revV = HF::adcIn(value.result_adc1);
|
||||
|
||||
fwdV = HF::divIn(fwdV);
|
||||
fwdV = HF::divIn(fwdV, uBitxSensorsFwdPwrR1, uBitxSensorsFwdPwrR2);
|
||||
fwdV = HF::bridgeFwd(fwdV);
|
||||
|
||||
revV = HF::divIn(revV);
|
||||
revV = HF::divIn(revV, uBitxSensorsRevPwrR1, uBitxSensorsRevPwrR2);
|
||||
revV = HF::bridgeFwd(revV);
|
||||
|
||||
fwdPwr.add(HF::P(fwdV));
|
||||
@ -239,8 +242,8 @@ class UBitxSensors {
|
||||
* reading the associated ADC pin.
|
||||
*/
|
||||
inline void updateSupply() {
|
||||
float value = HF::adcIn(adc.analogRead(supplyPin);
|
||||
value = HF::divIn(value);
|
||||
float value = HF::adcIn(adc.analogRead(supplyPin));
|
||||
value = HF::divIn(value, uBitxSensorsSupplyR1, uBitxSensorsSupplyR2);
|
||||
supply.add(value);
|
||||
}
|
||||
|
||||
@ -322,15 +325,15 @@ class UBitxSensors {
|
||||
// Pins
|
||||
int sMeterPin;
|
||||
int fwdPwrPin;
|
||||
int revPwdPin;
|
||||
int revPwrPin;
|
||||
int supplyPin;
|
||||
|
||||
// Buffers for averages
|
||||
AverageBuffer<int, uBitxSensorsAvgSamples> sMeter;
|
||||
AverageBuffer<float, uBitxSensorsAvgSamples> fwdPwr;
|
||||
AverageBuffer<float, uBitxSensorsAvgSamples> revPwr;
|
||||
AverageBuffer<float, uBitxSensorsAvgSamples> vswr;
|
||||
AverageBuffer<float, uBitxSensorsAvgSamples> supply;
|
||||
TrailingAverage<int, uBitxSensorsAvgSamples> sMeter;
|
||||
TrailingAverage<float, uBitxSensorsAvgSamples> fwdPwr;
|
||||
TrailingAverage<float, uBitxSensorsAvgSamples> revPwr;
|
||||
TrailingAverage<float, uBitxSensorsAvgSamples> vswr;
|
||||
TrailingAverage<float, uBitxSensorsAvgSamples> supply;
|
||||
};
|
||||
|
||||
extern UBitxSensors Sensors;
|
||||
|
@ -376,15 +376,15 @@ void i2cReceiveEvent(size_t numBytes)
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Respond to a request from the I2C Master (Raduino). Returns the appropriate data
|
||||
* based on whatever command was previously issued.
|
||||
@brief Respond to a request from the I2C Master (Raduino). Returns the appropriate data
|
||||
based on whatever command was previously issued.
|
||||
*/
|
||||
void i2cRequestEvent(void)
|
||||
{
|
||||
int maxValue = 0;
|
||||
int minValue = 30000;
|
||||
int readValue = 0;
|
||||
unsigned long curr = 0;
|
||||
//int maxValue = 0;
|
||||
//int minValue = 30000;
|
||||
//int readValue = 0;
|
||||
//unsigned long curr = 0;
|
||||
|
||||
switch (i2cCommand) {
|
||||
case I2CMETER_CALCS:
|
||||
@ -464,7 +464,7 @@ void loop()
|
||||
if (sinceFrameMillis > frameIntervalMillis) {
|
||||
// Do stuff that we do once per frame--I/O.
|
||||
// TODO: debug output (frame skipping / utilization).
|
||||
sinceFrame = 0;
|
||||
sinceFrameMillis = 0;
|
||||
|
||||
if (isTX) {
|
||||
calcVSWR = Sensors.VSWR();
|
||||
@ -474,7 +474,7 @@ void loop()
|
||||
|
||||
// Send SWR meter information.
|
||||
if (L_scaledVSWR != scaledVSWR) {
|
||||
L_scaledVSWR = scaledVSWR
|
||||
L_scaledVSWR = scaledVSWR;
|
||||
sendCommand1Num(CMD_SMETER, scaledVSWR);
|
||||
}
|
||||
|
||||
@ -503,9 +503,9 @@ void loop()
|
||||
//} //end of delay time
|
||||
|
||||
// Send SWR.
|
||||
if (L_calcSWR != calcSWR) {
|
||||
L_calcSWR = calcSWR;
|
||||
sendCommandL('m', int(calcSWR * 100.0)); // SWR x 100?
|
||||
if (L_calcVSWR != calcVSWR) {
|
||||
L_calcVSWR = calcVSWR;
|
||||
sendCommandL('m', int(calcVSWR * 100.0)); // SWR x 100?
|
||||
sendCommand1Num('m', 3);
|
||||
}
|
||||
|
||||
@ -523,13 +523,13 @@ void loop()
|
||||
}
|
||||
|
||||
// Forward any data that came in while we were updating stuff.
|
||||
ForwardData();
|
||||
forwardData();
|
||||
}
|
||||
|
||||
if (sinceADCMillis > adcIntervalMillis) {
|
||||
// Do stuff that we do once per ADC interval--ADC colllection.
|
||||
// TODO: debug output (frame skipping / utilization).
|
||||
sinceADC = 0;
|
||||
sinceADCMillis = 0;
|
||||
|
||||
if (isTX) {
|
||||
Sensors.updatePower();
|
||||
@ -539,7 +539,7 @@ void loop()
|
||||
}
|
||||
|
||||
// Forward any data that came in while we were reading sensors.
|
||||
//ForwardData();
|
||||
//forwardData();
|
||||
}
|
||||
|
||||
// Check Response Command
|
||||
|
Loading…
x
Reference in New Issue
Block a user