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.

Making a needle go round and round =)

Featured Replies

Hey, I'm trying to get a needle to go from 0 and around to zero again for units in a value like this:NONLINEARITY ng2_nonLinearity[] ={ { {175, 199}, 0, 0}, { {164, 196}, 1, 0}, { {156, 186}, 2, 0}, { {156, 174}, 3, 0}, { {164, 164}, 4, 0}, { {175, 199}, 5, 0}, { {187, 164}, 6, 0}, { {193, 174}, 7, 0}, { {193, 186}, 8, 0}, { {187, 196}, 9, 0},};FLOAT64 FSAPI NgNeedle2_cb(PELEMENT_NEEDLE pelement){ double temp = pelement->source_var.var_value.n / 1638.4; return (temp - (int)temp ) * 10;}and, of course, the needle gets to .9 correctly, but then as it goes to zero, it moves CCW back to zero to begin again, while I want it to simply keeping moving forward.I'm guessing one way to solve this is just to leave the integer part so it gets larger and larger.Other ideas?

I tried this:NONLINEARITY ng2_nonLinearity[] ={ { {175, 199}, 0, 0}, { {164, 196}, 1, 0}, { {156, 186}, 2, 0}, { {156, 174}, 3, 0}, { {164, 164}, 4, 0}, { {175, 199}, 5, 0}, { {187, 164}, 6, 0}, { {193, 174}, 7, 0}, { {193, 186}, 8, 0}, { {187, 196}, 9, 0}};FLOAT64 FSAPI NgNeedle2_cb(PELEMENT_NEEDLE pelement){ return pelement->source_var.var_value.n / 163.84;}which basically just lets the units needle continue around, but now it does not line up on the correct unit number.For example, the value might be "79.9" and the main needle pointing correctly, and this needle pointing to the '7'. The non-linearity is correct, and the gauge did correctly point earlier when it would return to zero to begin again.So, not sure what others do to solve this.

You might try this:NONLINEARITY ng2_nonLinearity[] ={{ {175, 199}, 0, 0},{ {164, 196}, 1, 0},{ {156, 186}, 2, 0},{ {156, 174}, 3, 0},{ {164, 164}, 4, 0},{ {175, 199}, 5, 0},{ {187, 164}, 6, 0},{ {193, 174}, 7, 0},{ {193, 186}, 8, 0},{ {187, 196}, 9, 0},{ {175, 199}, 10, 0}, //Bring non-linearity back round to 0};FLOAT64 FSAPI NgNeedle2_cb(PELEMENT_NEEDLE pelement){double previous_return;double temp = pelement->source_var.var_value.n / 1638.4;temp = (temp - (int)temp ) * 10;if ( previous_return > 9.5 && temp < 0.5 ) { previous_return = temp; return temp + 10; //Special case - we've crossed the line }else { previous_return = temp; return temp; //Normal case }}Doug

Doug,Thanks for the suggestion. Just before reading this, I tried adding the 10 line to the non-linearity, and then I also lowered the so-called "degs-per-sec" variable that controls the number of tics required between draws to zero. That did the trick for the most part, and it now spins continuously.I forgot to change the main needle to '0' too, and think that was causing it to lag, so I'm about to test it.If that doesn't work, then I'll insert your suggested code, which is a great idea too.Patrick

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.