diff --git a/HamShield.cpp b/HamShield.cpp index 7fe816a..eae5b2f 100644 --- a/HamShield.cpp +++ b/HamShield.cpp @@ -384,7 +384,7 @@ void HamShield::setTX(bool on_noff){ setGpioLow(5); // remember that RX and TX are active low // then turn on VREG (PWM output) // then apply RF signal - setRfPower(100); // figure out a good default number (or don't set a default) + setRfPower(9); // figure out a good default number (or don't set a default) } // todo: make sure gpio are set correctly after this @@ -943,19 +943,12 @@ void HamShield::setRfPower(uint8_t pwr) { // (see RF6886 datasheet) // 30 is 0.5V, which is ~min loop reference voltage // 127 is 2.5V, which is ~max loop ref voltage - int max_pwr = 255; //167; // 167 is 3.3*255/5 - 1; + int max_pwr = 15; //167; // 167 is 3.3*255/5 - 1; if (pwr > max_pwr) { pwr = max_pwr; } - - // using open loop reference voltage into Vreg1/2 - /*int max_pwr = 78; // 78 = 1.58*255/5 - 1 - if (pwr > max_pwr) { - pwr = max_pwr; - }*/ - // using loop ref voltage as specified in RF6886 datasheet - // analogWrite(pwr_control_pin, pwr); + I2Cdev::writeBitsW(devAddr, A1846S_PABIAS_REG, A1846S_PADRV_BIT, A1846S_PADRV_LENGTH, pwr); } diff --git a/HamShield.h b/HamShield.h index 45949a1..5006af3 100644 --- a/HamShield.h +++ b/HamShield.h @@ -89,6 +89,9 @@ #define A1846S_PABIAS_BIT 5 // pabias_voltage<5:0> #define A1846S_PABIAS_LENGTH 6 +#define A1846S_PADRV_BIT 14 // pabias_voltage<14:11> +#define A1846S_PADRV_LENGTH 4 + // Bitfields for A1846S_BAND_SEL_REG #define A1846S_BAND_SEL_BIT 7 // band_sel<1:0> #define A1846S_BAND_SEL_LENGTH 2 diff --git a/examples/SerialTransceiver/SerialTransceiver.ino b/examples/SerialTransceiver/SerialTransceiver.ino index 3733302..ff033a0 100755 --- a/examples/SerialTransceiver/SerialTransceiver.ino +++ b/examples/SerialTransceiver/SerialTransceiver.ino @@ -17,7 +17,7 @@ Frequency F; Set the receive frequency in KHz, if offset is disabl CDCSS In G; must be a valid CDCSS code No CDCSS Out H; must be a valid CDCSS code No Print tones I Prints out all configured tones and codes, coma delimited in format: CTCSS In, CTCSS Out, CDCSS In, CDCSS Out No -Power level P; Set the power amp level, 0 = lowest, 255 = highest No +Power level P; Set the power amp level, 0 = lowest, 15 = highest No Enable Offset R; 1 turns on repeater offset mode, 0 turns off repeater offset mode No Squelch S; Set the squelch level No TX Offset T; The absolute frequency of the repeater offset to transmit on in KHz No @@ -81,7 +81,7 @@ void setup() { radio.setVolume2(0xF); radio.setModeReceive(); radio.setTxSourceMic(); - radio.setRfPower(255); // 30 is 0.5V, which corresponds to 29 dBm out (see RF6886 datasheet) + radio.setRfPower(9); radio.setSQLoThresh(80); radio.setSQOn(); }