diff --git a/.gitignore b/.gitignore index 723ef36..706fd07 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea \ No newline at end of file +.idea +.vscode diff --git a/barani-meteo-wind-2023.js b/barani-meteo-wind-2023.js new file mode 100644 index 0000000..7a66838 --- /dev/null +++ b/barani-meteo-wind-2023.js @@ -0,0 +1,122 @@ +var pos = 0; +var bindata = ""; + +var ConvertBase = function (num) { + return { + from : function (baseFrom) { + return { + to : function (baseTo) { + return parseInt(num, baseFrom).toString(baseTo); + } + }; + } + }; +}; + +function pad(num) { + var s = "0000000" + num; + return s.slice(-8); +} + +function windify(num) { + if (num > 0) { + return num * 0.6335 + 0.3582 + } else { + return 0 + } + + } + +ConvertBase.dec2bin = function (num) { + return pad(ConvertBase(num).from(10).to(2)); +}; + +ConvertBase.bin2dec = function (num) { + return ConvertBase(num).from(2).to(10); +}; + +function data2bits(data) { + var binary = ""; + for(var i=0; i