- 10 mar 2017, 19:55
#69363
Goedendag.
Ik ben nu een tijdje bezig met de LED, ik heb nu het volgende ingesteld.
De threshold kan wel degelijk als een statisch getal als ook een varierende waarde worden gegeven.
Ik heb nu in de wind gauge de threshold zo gezet dat deze de hoogste waarde van de avgwind aanhoudt, komt de wind daarboven dan gaat de LED knipperen, ook heb ik de LED een gele kleur gegeven, waarde ledColor.
Voor een statische waarde kan de threshold op bijv 50 gezet worden:
unction drawWind() {
// create wind speed radial gauge
if (document.getElementById('canvas_wind')) {
gauge_wind = new steelseries.Radial(
'canvas_wind', {
size : g_size,
gaugeType : steelseries.GaugeType.TYPE2,
area : g_wind.areas,
minValue : 0,
maxValue : g_wind.maxValue,
section : [],
thresholdVisible : true,
threshold: 50,
minMeasuredValueVisible : false,
maxMeasuredValueVisible : true,
ledVisible : true,
ledBlinking : true,
ledColor: steelseries.LedColor.YELLOW_LED,
titleString : g_wind.title,
unitString : g_windunit,
lcdDecimals : 1,
frameDesign : g_frameDesign,
backgroundColor : g_background,
foregroundType : g_foreground,
pointerType : g_pointer,
pointerColor : g_pointerColour,
knobType : g_knob,
knobStyle : g_knobStyle,
lcdColor : g_lcdColour,
digitalFont : g_digitalFont,
tickLabelOrientation: g_tickLabelOrientation,
labelNumberFormat : g_labelFormat
});
gauge_wind.setMaxMeasuredValue(g_wind.maxMeasured);
gauge_wind.setValue(g_wind.value);
}
} // eof drawWind
Of gebruik de functie:
g_wind.setThreshold, dit wordt dan aangegeven bij doWind:
function doWind() {
g_wind.value = extractDecimal(data.wlatest);
g_wind.valuebft = extractDecimal(data.wlatestbft);
g_wind.average = extractDecimal(data.wspeed);
g_wind.gust = extractDecimal(data.wgust);
g_wind.maxGustToday = extractDecimal(data.wgustTM);
g_wind.maxGustTodayBft = extractDecimal(data.wgustTMBft);
g_wind.maxAvgToday = extractDecimal(data.windTM);
switch (g_windunit) {
case 'mph':
case 'kts':
g_wind.maxValue = Math.max(Math.ceil(g_wind.maxGustToday / 10) * 10, 20);
break;
case 'm/s':
g_wind.maxValue = Math.max(Math.ceil(g_wind.maxGustToday / 5) * 5, 10);
break;
default:
g_wind.maxValue = Math.max(Math.ceil(g_wind.maxGustToday / 20) * 20, 30);
}
g_wind.areas = [
steelseries.Section(0, +g_wind.average, 'rgba(40,255,40,0.4)'),
steelseries.Section(+g_wind.average, +g_wind.gust, 'rgba(255,0,0,0.6)')
];
if (g_wind.maxValue !== gauge_wind.getMaxValue()) {
gauge_wind.setMaxValue(g_wind.maxValue);
}
gauge_wind.setArea(g_wind.areas);
gauge_wind.setMaxMeasuredValue(g_wind.maxGustToday);
gauge_wind.setValueAnimated(g_wind.value);
gauge_wind.setThreshold(g_wind.gust);
Ik heb hierboven nog wat waarden in bft aangegeven, deze worden in de pop up gebruikt.
(g_wind.maxGustTodayBft = extractDecimal(data.wgustTMBft)) is daar eenn van.
Er is nog een LED beschikbaar, de Userled, de LED aan de linkerkant, hier ga ik binnenkort nog wat mee bezig.
Er zijn nog meer mogelijkheden zoals alarm geluid afspelen etc.
Het enige wat ik nu bij windstil weer heb is dat de LED knippert bij geen wind, de threshold is immers 0.
Succes en ik hoop dat je hier wat aan hebt.
Groeten Tjeerd