Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIX and MAX frequency labels are swapped in index.html.h #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LoRaWANGateway/index.html.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ return uptime;};let Wan=function(parent,name){Node.call(this,parent,name);this.t
Wan.prototype[i]=Node.prototype[i];Wan.prototype.init=function(data){};Wan.prototype.onmessage=function(data){this[data.n](data.p);};Wan.prototype.onSaved=function(hrdwr){this.parent.hideWaiting();this.hrdwr(hrdwr);};Wan.prototype.ack=function(params){this.lastACK=Date.now();this.log(params);};Wan.prototype.tic=function(){let ticInterval=60*1000;clearTimeout(this.signalCallback);this.ticCallback=setTimeout(this.tic.bind(this),ticInterval);this.updateSignal();};Wan.prototype.updateSignal=function(){let now=Date.now();let diff=now-this.lastACK;let maxLevel=3;let minLevel=-1;let totalLevel=maxLevel-minLevel;let timeRule=totalLevel*60*1000;let normalized=diff/timeRule;let discrette=Math.floor(normalized*totalLevel);let meassuredLevel=maxLevel-discrette;let level=Math.max(minLevel,Math.min(meassuredLevel,maxLevel));this.signal.input.setLevel(level);};Wan.prototype.log=function(params){var now=new Date(1000*params.tstm);let date=now.toLocaleDateString('en-US',TSTMP_OPTIONS);let line='['+date+'] '+params.text;this.console.addTextLine(line);};Wan.prototype.isChanged=function(command){let changed=this.id.changed||this.host.changed||this.port.changed||this.desc.changed;changed=changed||this.mail.changed||this.platform.changed||this.lon.changed;changed=changed||this.lat.changed||this.alt.changed||this.istat.changed||this.ipull.changed;return changed;};Wan.prototype.save=function(command){Node.prototype.save.call(this,command);let wan=command.save={};if(this.id.changed)wan.id=this.id.value();if(this.host.changed)wan.host=this.host.value();if(this.port.changed)wan.port=this.port.value()|0;if(this.desc.changed)wan.desc=this.desc.value();if(this.mail.changed)wan.mail=this.mail.value();if(this.platform.changed)wan.platform=this.platform.value();if(this.lon.changed)wan.lon=this.lon.value();if(this.lat.changed)wan.lat=this.lat.value();if(this.alt.changed)wan.alt=this.alt.value();if(this.istat.changed)wan.istat=1000*this.istat.value();if(this.ipull.changed)wan.ipull=1000*this.ipull.value();};Wan.prototype.state=function(wan){if('id'in wan)this.id.pong(wan.id);if('host'in wan)this.host.pong(wan.host);if('port'in wan)this.port.pong(wan.port);if('desc'in wan)this.desc.pong(wan.desc);if('mail'in wan)this.mail.pong(wan.mail);if('platform'in wan)this.platform.pong(wan.platform);if('lon'in wan)this.lon.pong(wan.lon);if('lat'in wan)this.lat.pong(wan.lat);if('alt'in wan)this.alt.pong(wan.alt);if('istat'in wan){let istat=(wan.istat/1000).toFixed(2);this.istat.pong(istat);}
if('ipull'in wan){let ipull=(wan.ipull/1000).toFixed(2);this.ipull.pong(ipull);}
if('now'in wan){let now=Date.now();let timeDiff=now-(+wan.now);this.lastACK=+wan.ack+timeDiff;this.tic();}
if(wan.stats){this.stats.textContent=`up:${wan.stats.rxnb} ::: sent:${wan.stats.rxfw} ::: down:${wan.stats.dwnb} ::: emitted:${wan.stats.txnb}`;}};Wan.prototype.pong=function(pong){};Wan.prototype.showMessage=function(message){this.parent.showMessage(message,true);};let TXPWS=[];TXPWS.push(['2 dB',2]);TXPWS.push(['3 dB',3]);TXPWS.push(['4 dB',4]);TXPWS.push(['5 dB',5]);TXPWS.push(['6 dB',6]);TXPWS.push(['7 dB',7]);TXPWS.push(['8 dB',8]);TXPWS.push(['9 dB',9]);TXPWS.push(['10 dB',10]);TXPWS.push(['11 dB',11]);TXPWS.push(['12 dB',12]);TXPWS.push(['13 dB',13]);TXPWS.push(['14 dB',14]);TXPWS.push(['15 dB',15]);TXPWS.push(['16 dB',16]);TXPWS.push(['17 dB',17]);TXPWS.push(['18 dB',18]);TXPWS.push(['19 dB',19]);TXPWS.push(['20 dB',20]);let SFACS=[];SFACS[0]=['6',6];SFACS[1]=['7',7];SFACS[2]=['8',8];SFACS[3]=['9',9];SFACS[4]=['10',10];SFACS[5]=['11',11];SFACS[6]=['12',12];let SBWS=[];SBWS[0]=['7800 Hz',7800];SBWS[1]=['10400 Hz',10400];SBWS[2]=['15600 Hz',15600];SBWS[3]=['20800 Hz',20800];SBWS[4]=['31250 Hz',31250];SBWS[5]=['41700 Hz',41700];SBWS[6]=['62500 Hz',62500];SBWS[7]=['125000 Hz',125000];SBWS[8]=['250000 Hz',250000];let CRATS=[];CRATS[0]=['5',5];CRATS[1]=['6',6];CRATS[2]=['7',7];CRATS[3]=['8',8];let RFM=function(parent,name){Node.call(this,parent,name);this.tag=document.createElement('div');this.tag.className='RFM';this.tag.node=this;this.title=document.createElement('div');this.title.className='Title';this.title.textContent='Radio Frequency Module:';this.tag.append(this.title);this.title.style.width='calc(100% - 1.2em)';this.separator=document.createElement('div');this.separator.className='Separator';this.tag.append(this.separator);this.status=new StatusRow(this,'status');this.tag.append(this.status.tag);this.status.input.label.textContent='initialized';this.status.input.point.style['background-color']='#0F0';this.freq=new InputRow(this,'Frequency MHz','text','');this.tag.append(this.freq.tag);this.freq.validator=new FloatValidator(this.freq);this.freq.setHelp('This is the frequency the Radio Frequency Module is currently operaing at.');this.configuration=new Advanced(this,'Configuration');this.configuration.tag.className='Advanced';this.tag.append(this.configuration.tag);this.minfreq=new InputRow(this,'MAX Frequency','text','');this.minfreq.tag.classList.add('Boundary');this.configuration.append(this.minfreq.tag);this.minfreq.validator=new FloatValidator(this.minfreq);this.minfreq.setHelp(`MHz min and max are the boundaries the Radio Frequency Module can operate at. TTN is going to tell the gateway the frequency it should use to emit DOWN packets, if it's outside this boundaries, the gateway will answer TTN with an 'unsupported frequency error'.`);this.maxfreq=new InputRow(this,'MIN Frequency','text','');this.maxfreq.tag.classList.add('Boundary');this.configuration.append(this.maxfreq.tag);this.maxfreq.validator=new FloatValidator(this.maxfreq);this.txpw=new InputRow(this,'TX power','select','');this.txpw.addOptions(TXPWS);this.configuration.append(this.txpw.tag);this.txpw.setHelp('This is the default power the module should emmit with.');this.cad=new InputRow(this,'CAD','checkbox','');this.cad.input.input.className='';this.cad.input.input.disabled=true;this.configuration.append(this.cad.tag);this.cad.setHelp(`CAD Stands for Channel Activity Detection, this version doesn't supoprt it, it will be added in a future release.`);this.sfac=new InputRow(this,'Spreading Factor','select','');this.sfac.addOptions(SFACS);this.configuration.append(this.sfac.tag);this.sfac.setHelp('This is the Spreading Factor the Radio Frequency Module is going to use to receive packets if CAD is turned OFF (wich in this version is still unsupported). TTN is going to tell the gateway which SF it should use to emit DOWN packets.');this.sbw=new InputRow(this,'Band Width','select','');this.sbw.addOptions(SBWS);this.configuration.append(this.sbw.tag);this.sbw.setHelp('This is the Bandwidth the Radio Frequency Module is going to use to receive packets if CAD is turned OFF (wich in this version is still unsupported). TTN is going to tell the gateway wich Bandwidth configuration it should use to emit DOWN packets.');this.plength=new InputRow(this,'Preamble Length','text','');this.plength.tag.classList.add('Short');this.configuration.append(this.plength.tag);this.plength.validator=new IntegerValidator(this.plength,1);this.plength.setHelp('This is an advanced configuration, default value should work, yet you can change it if you need.');this.sw=new InputRow(this,'Sync Word','text','');this.sw.tag.classList.add('Short');this.configuration.append(this.sw.tag);this.sw.validator=new ByteValidator(this.sw);this.sw.setHelp('This is an advanced configuration, default value should work, yet you can change it if you need.');this.pins=new Advanced(this,'PIN connections');this.pins.tag.className='Advanced Pins';this.tag.append(this.pins.tag);this.explanation=document.createElement('div');this.explanation.className='TextContent';this.explanation.textContent='PIN configuration (disabled options are not available in this version)';this.pins.append(this.explanation);this.separator=document.createElement('div');this.separator.className='Separator';this.pins.append(this.separator);this.miso=new InputRow(this,'MISO','select','',true);this.miso.addOptions(PINS);this.pins.append(this.miso.tag);this.mosi=new InputRow(this,'MOSI','select','',true);this.mosi.addOptions(PINS);this.pins.append(this.mosi.tag);this.sck=new InputRow(this,'SCK','select','',true);this.sck.addOptions(PINS);this.pins.append(this.sck.tag);this.nss=new InputRow(this,'nss','select','');this.nss.addOptions(PINS);this.pins.append(this.nss.tag);this.rst=new InputRow(this,'reset','select','');this.rst.addOptions(PINS);this.pins.append(this.rst.tag);for(let i=0;i<=5;i++){let diox=this[`dio${i}`]=new InputRow(this,`dio${i}`,'select','',!!i);diox.addOptions(PINS);this.pins.append(diox.tag);}
if(wan.stats){this.stats.textContent=`up:${wan.stats.rxnb} ::: sent:${wan.stats.rxfw} ::: down:${wan.stats.dwnb} ::: emitted:${wan.stats.txnb}`;}};Wan.prototype.pong=function(pong){};Wan.prototype.showMessage=function(message){this.parent.showMessage(message,true);};let TXPWS=[];TXPWS.push(['2 dB',2]);TXPWS.push(['3 dB',3]);TXPWS.push(['4 dB',4]);TXPWS.push(['5 dB',5]);TXPWS.push(['6 dB',6]);TXPWS.push(['7 dB',7]);TXPWS.push(['8 dB',8]);TXPWS.push(['9 dB',9]);TXPWS.push(['10 dB',10]);TXPWS.push(['11 dB',11]);TXPWS.push(['12 dB',12]);TXPWS.push(['13 dB',13]);TXPWS.push(['14 dB',14]);TXPWS.push(['15 dB',15]);TXPWS.push(['16 dB',16]);TXPWS.push(['17 dB',17]);TXPWS.push(['18 dB',18]);TXPWS.push(['19 dB',19]);TXPWS.push(['20 dB',20]);let SFACS=[];SFACS[0]=['6',6];SFACS[1]=['7',7];SFACS[2]=['8',8];SFACS[3]=['9',9];SFACS[4]=['10',10];SFACS[5]=['11',11];SFACS[6]=['12',12];let SBWS=[];SBWS[0]=['7800 Hz',7800];SBWS[1]=['10400 Hz',10400];SBWS[2]=['15600 Hz',15600];SBWS[3]=['20800 Hz',20800];SBWS[4]=['31250 Hz',31250];SBWS[5]=['41700 Hz',41700];SBWS[6]=['62500 Hz',62500];SBWS[7]=['125000 Hz',125000];SBWS[8]=['250000 Hz',250000];let CRATS=[];CRATS[0]=['5',5];CRATS[1]=['6',6];CRATS[2]=['7',7];CRATS[3]=['8',8];let RFM=function(parent,name){Node.call(this,parent,name);this.tag=document.createElement('div');this.tag.className='RFM';this.tag.node=this;this.title=document.createElement('div');this.title.className='Title';this.title.textContent='Radio Frequency Module:';this.tag.append(this.title);this.title.style.width='calc(100% - 1.2em)';this.separator=document.createElement('div');this.separator.className='Separator';this.tag.append(this.separator);this.status=new StatusRow(this,'status');this.tag.append(this.status.tag);this.status.input.label.textContent='initialized';this.status.input.point.style['background-color']='#0F0';this.freq=new InputRow(this,'Frequency MHz','text','');this.tag.append(this.freq.tag);this.freq.validator=new FloatValidator(this.freq);this.freq.setHelp('This is the frequency the Radio Frequency Module is currently operaing at.');this.configuration=new Advanced(this,'Configuration');this.configuration.tag.className='Advanced';this.tag.append(this.configuration.tag);this.minfreq=new InputRow(this,'MIN Frequency','text','');this.minfreq.tag.classList.add('Boundary');this.configuration.append(this.minfreq.tag);this.minfreq.validator=new FloatValidator(this.minfreq);this.minfreq.setHelp(`MHz min and max are the boundaries the Radio Frequency Module can operate at. TTN is going to tell the gateway the frequency it should use to emit DOWN packets, if it's outside this boundaries, the gateway will answer TTN with an 'unsupported frequency error'.`);this.maxfreq=new InputRow(this,'MAX Frequency','text','');this.maxfreq.tag.classList.add('Boundary');this.configuration.append(this.maxfreq.tag);this.maxfreq.validator=new FloatValidator(this.maxfreq);this.txpw=new InputRow(this,'TX power','select','');this.txpw.addOptions(TXPWS);this.configuration.append(this.txpw.tag);this.txpw.setHelp('This is the default power the module should emmit with.');this.cad=new InputRow(this,'CAD','checkbox','');this.cad.input.input.className='';this.cad.input.input.disabled=true;this.configuration.append(this.cad.tag);this.cad.setHelp(`CAD Stands for Channel Activity Detection, this version doesn't supoprt it, it will be added in a future release.`);this.sfac=new InputRow(this,'Spreading Factor','select','');this.sfac.addOptions(SFACS);this.configuration.append(this.sfac.tag);this.sfac.setHelp('This is the Spreading Factor the Radio Frequency Module is going to use to receive packets if CAD is turned OFF (wich in this version is still unsupported). TTN is going to tell the gateway which SF it should use to emit DOWN packets.');this.sbw=new InputRow(this,'Band Width','select','');this.sbw.addOptions(SBWS);this.configuration.append(this.sbw.tag);this.sbw.setHelp('This is the Bandwidth the Radio Frequency Module is going to use to receive packets if CAD is turned OFF (wich in this version is still unsupported). TTN is going to tell the gateway wich Bandwidth configuration it should use to emit DOWN packets.');this.plength=new InputRow(this,'Preamble Length','text','');this.plength.tag.classList.add('Short');this.configuration.append(this.plength.tag);this.plength.validator=new IntegerValidator(this.plength,1);this.plength.setHelp('This is an advanced configuration, default value should work, yet you can change it if you need.');this.sw=new InputRow(this,'Sync Word','text','');this.sw.tag.classList.add('Short');this.configuration.append(this.sw.tag);this.sw.validator=new ByteValidator(this.sw);this.sw.setHelp('This is an advanced configuration, default value should work, yet you can change it if you need.');this.pins=new Advanced(this,'PIN connections');this.pins.tag.className='Advanced Pins';this.tag.append(this.pins.tag);this.explanation=document.createElement('div');this.explanation.className='TextContent';this.explanation.textContent='PIN configuration (disabled options are not available in this version)';this.pins.append(this.explanation);this.separator=document.createElement('div');this.separator.className='Separator';this.pins.append(this.separator);this.miso=new InputRow(this,'MISO','select','',true);this.miso.addOptions(PINS);this.pins.append(this.miso.tag);this.mosi=new InputRow(this,'MOSI','select','',true);this.mosi.addOptions(PINS);this.pins.append(this.mosi.tag);this.sck=new InputRow(this,'SCK','select','',true);this.sck.addOptions(PINS);this.pins.append(this.sck.tag);this.nss=new InputRow(this,'nss','select','');this.nss.addOptions(PINS);this.pins.append(this.nss.tag);this.rst=new InputRow(this,'reset','select','');this.rst.addOptions(PINS);this.pins.append(this.rst.tag);for(let i=0;i<=5;i++){let diox=this[`dio${i}`]=new InputRow(this,`dio${i}`,'select','',!!i);diox.addOptions(PINS);this.pins.append(diox.tag);}
this.separator=document.createElement('div');this.separator.className='Separator';this.tag.append(this.separator);this.explanation=document.createElement('div');this.explanation.className='TextContent';this.explanation.textContent='Radio Frequency Module console log:';this.tag.append(this.explanation);this.console=new Console();this.tag.append(this.console.tag);};for(let i in Node.prototype)
RFM.prototype[i]=Node.prototype[i];RFM.prototype.init=function(data){this.console.addTextLine('RX/TX console v1.0');};RFM.prototype.onopen=function(){this.console.addTextLine('RFM Module console v1.0 connected');};RFM.prototype.onerror=function(error){this.console.addTextLine(''+error);};RFM.prototype.onclose=function(e){this.console.addTextLine('disconnected from server, reconnecting ...');setTimeout(this.connect.bind(this),2000);};RFM.prototype.onmessage=function(data){let name=data.n;let params=data.p;if(!(name in this)){console.log('no method found: ');console.log(data);}
this[name](params);};RFM.prototype.log=function(params){var now=new Date(1000*params.tstm);let date=now.toLocaleDateString('en-US',TSTMP_OPTIONS);let line='['+date+'] '+params.text;this.console.addTextLine(line);};RFM.prototype.isChanged=function(){let changed=this.freq.changed||this.minfreq.changed||this.maxfreq.changed||this.txpw.changed||this.sfac.changed||this.sbw.changed||this.plength.changed||this.sw.changed||this.miso.changed||this.mosi.changed||this.sck.changed||this.nss.changed||this.rst.changed;for(let i=0;i<=5;i++)
Expand Down