Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem with com radio and make_string

Featured Replies

Hi Guru'sI'm trying to make a Bendix/King com radio, but I have a BIG problem.I can't manage to get the frequency (or any other string) to show up.Here is my make_string element and callback function:MAKE_STRING (com_frequency_whole, NULL, navcom1_fail, erase | bright, 0, 60, 70, 60, 30, 3, MODULE_VAR_NONE, MODULE_VAR_NONE, MODULE_VAR_NONE, RGB(255,0,0), RGB(0,0,0), RGB(92,92,92), GAUGE_FONT_DEFAULT, GAUGE_WEIGHT_DEFAULT, GAUGE_CHARSET, 0, DT_CENTER | DT_VCENTER | DT_SINGLELINE, NULL, frequency_update)FLOAT64 FSAPI frequency_update(PELEMENT_STRING pelement){ FLOAT64 val=pelement->source_var[0].var_value.n; val=!val; lookup_var(&active); //active reads the COM_FREQUENCY tokenVar wsprintf(pelement->string, "%3f", active); return val;}I've tried a LOT of different things just to get it to show anything. But no string in sight... Any help/thoughts will be higly appreciated.Lars Martinhttp://flightsimmers.net/airfield/fma

You have to use the .d member, not the .f member of the module var. Ther are several ways to proceed (convert BCD to decimal etc.), but for a simple display, a sprintf like this would do:sprintf(pelement->string,"1%02x.%02x",active.var_value.d/0x100,active.var_value.d%0x100);BTW wsprintf can't print floats (%...f doesn't work) and using a module var directly, and not it's members doesn't make sense.If you set the COMx_FREQUENCY in the MAKE_STRING macro the callback can be simplified to:...#include <stdio.h>...FLOAT64 FSAPI frequency_update(PELEMENT_STRING pelement){ int val = pelement->source_var<0>.var_value.d; sprintf( pelement->string,"1%02x.%02x",val/0x100,val%0x100); return val;}

ThanksThats why people ask you, and not me:-)Anyway, I got it to work last night (very late), but your code looks much better than mine.Lars Martinhttp://flightsimmers.net/airfield/fma

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.