9 lines
563 B
Django/Jinja

{% if 'rxtx' in params and modem == 'scpc' %}
calcInterfaceSpeedKb(baud, modulation, speed) {
const mMod = Math.max(2, ['', '', 'qpsk', '8psk', '16apsk', '32apsk'].indexOf(modulation))
const speedVals = {'1/4': 0.25, '1/3': 0.333, '2/5': 0.4, '1/2': 0.5, '3/5': 0.6, '2/3': 0.666, '3/4': 0.75, '4/5': 0.8, '5/6': 0.833, '8/9': 0.888, '9/10': 0.9}
const mSpeed = speed in speedVals ? speedVals[speed] : 1
return ((baud * mMod * mSpeed) / 1024).toLocaleString()
},
{% endif %}