#endif
}
-//if(last_power!=power) {
-// g_print("power=%d\n",power);
-// last_power=power;
-//}
+ /* if(last_power!=power) { */
+ /* int computed_gain = (power >> 5) + ((power + 4) >> 3); */
+ /* g_print("power=%d, computed gain = %d\n",power, computed_gain); */
+ /* last_power=power; */
+ /* } */
output_buffer[C0]=0x12; /* addr[6:1] = 001001b */
output_buffer[C1]=power & 0xFF;
}
static int calcLevel(double d) {
- fprintf(stderr, "calcLevel: input d = %f..", d);
int level = 0;
int v = get_tx_vfo();
BAND *band = band_get_band(vfo[v].band);
- double target_dbm = 10.0 * log10(d * 1000.0);
+ double target_dbm_orig = 10.0 * log10(d * 1000.0);
double gbb = band->pa_calibration;
- target_dbm -= gbb;
+ double target_dbm = target_dbm_orig - gbb;
double target_volts = sqrt(pow(10, target_dbm * 0.1) * 0.05);
double volts = min((target_volts / 0.8), 1.0);
double actual_volts = volts * (1.0 / 0.98);
+ /* printf("calcLevel: d = %f\n", d); */
+ /* printf("calcLevel: target_dbm_orig = %f\n", target_dbm_orig); */
+ /* printf("calcLevel: gbb = %f\n", gbb); */
+ /* printf("calcLevel: target_dbm = %f\n", target_dbm); */
+
if (actual_volts < 0.0) {
actual_volts = 0.0;
} else if (actual_volts > 1.0) {