DD4WH June, 9th 2016 ==================== ./hardware/mchf_board.h: uchar display_dbm; // display dbm or dbm/Hz or OFF uchar s_meter; // defines S-Meter style/configuration ./drivers/ui/menu/ui_menu_internal.h: // Enumeration for menu. enum { ... MENU_DBM_CALIBRATE, ... } ./drivers/ui/ui_configuration.h: #define EEPROM_DBM_CALIBRATE 379 ./drivers/audio/audio_driver.h: float32_t dbm; float32_t dbmhz; // S meter public typedef struct SMeter { ulong skip; ulong s_count; float gain_calc; int curr_max; float32_t dbm; float32_t dbmhz; } SMeter; extern __IO SMeter sm; ./drivers/audio/audio_driver.c void AudioDriver_Init(void) { ... // Reset S meter public sm.skip = 0; sm.s_count = 0; sm.curr_max = 0; sm.gain_calc = 0; // gain calculation used for S-meter ... } ./drivers/ui/ui_driver.c static void UiDriver_HandleSMeter() { ... else if (ts.s_meter == DISPLAY_S_METER_DBM) // based on dBm calculation { sm.gain_calc = sm.dbm; } ... // find corresponding signal level for ( sm.s_count = 0; (sm.gain_calc >= S_Meter_Cal_Ptr[sm.s_count]) && (sm.s_count < S_Meter_Cal_Size); sm.s_count++) { // nothing to do here } ... // make sure that the S meter always reads something! UiDriver_UpdateTopMeterA((sm.s_count>0) ? sm.s_count : 1); ... } ./drivers/ui/lcd/ui_spectrum.c static void UiSpectrum_DisplayDbm() { ... //Nur printout to LCD, do not care! ... } static void UiSpectrum_CalculateDBm() { ... if( ts.txrx_mode == TRX_MODE_RX && ((ts.s_meter != DISPLAY_S_METER_STD) || (ts.display_dbm != DISPLAY_S_METER_STD ))) { float32_t slope = 19.8; // 19.6; --> empirical values derived from measurements by DL8MBY, 2016/06/30, Thanks! ... float32_t bin_BW = (float32_t) (IQ_SAMPLE_RATE_F * 2.0 / buff_len); // width of a 256 tap FFT bin = 187.5Hz // we have to take into account the magnify mode // --> recalculation of bin_BW bin_BW = bin_BW / (1 << sd.magnify); // correct bin bandwidth is determined by the Zoom FFT display setting int buff_len_int = FFT_IQ_BUFF_LEN; // determine posbin (where we receive at the moment) from ts.iq_freq_mode // frequency translation off, IF = 0 Hz OR // in all magnify cases (2x up to 32x) the posbin is in the centre of the spectrum display ... }