Skip to content

Commit

Permalink
Enless Wireless LoRaWAN Transmitters (#796)
Browse files Browse the repository at this point in the history
* Added Enless Transmitter

* Changed the Regulatory compliances

* Added description and type in the yaml file

* validate fmt

* Modified the vender profile id as unique for both EU868 ans US915 profile

* Images added , Removed unused Transmitters , Description changes

* validate fmt

* 1. Added the temperature unit
2.Added Descriptions
3.Added partnet website link
4.F/W version updated

* corrected the Analog TX conversion and Temperature conversion changed to Signed int

---------

Co-authored-by: MINDTECK\reghu.nd <[email protected]>
Co-authored-by: Jaime Trinidad <[email protected]>
Co-authored-by: Jaime Trinidad <[email protected]>
  • Loading branch information
4 people authored Jul 10, 2024
1 parent 498041c commit d390fb6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
27 changes: 19 additions & 8 deletions vendor/enless-wireless/enlessdecoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function bin_decode(deviceType, payload) {
addValueField(template, {
current: {
unit: "mA",
value: hexToInt(payload.substring(12, 16), 10),
value: hexToInt(payload.substring(12, 16), 1000),
},
});

Expand Down Expand Up @@ -468,14 +468,25 @@ function hexToUInt(hex, divider=1) {
return parseInt(hex, 16) / divider;
}

function hexToInt(hex, divider) {
const upperHex = hex.toUpperCase();

if (parseInt(upperHex, 16) >= "8000" && parseInt(upperHex, 16) <= "FFFF") {
return (parseInt(hex, 16) - INT_MAX - 1) / divider;
} else {
return parseInt(hex, 16) / divider;
// function hexToInt(hex, divider) {
// const upperHex = hex.toUpperCase();

// if (parseInt(upperHex, 16) >= "8000" && parseInt(upperHex, 16) <= "FFFF") {
// return (parseInt(hex, 16) - INT_MAX - 1) / divider;
// } else {
// return parseInt(hex, 16) / divider;
// }
// }
function hexToInt(hex,divider) {
if (hex.length % 2 != 0) {
hex = "0" + hex;
}
var num = parseInt(hex, 16);
var maxVal = Math.pow(2, hex.length / 2 * 8);
if (num > maxVal / 2 - 1) {
num = num - maxVal
}
return num /divider;
}

function hexToBin(hex, numOfBytes = 2) {
Expand Down
2 changes: 1 addition & 1 deletion vendor/enless-wireless/tx-analog-600-035-codec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ uplinkDecoder:
values:
current:
unit: mA
value: 0.2
value: 0.002
4 changes: 2 additions & 2 deletions vendor/enless-wireless/tx-temp-cont1-600-032-codec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ uplinkDecoder:
- description: TX TEMP INS 600-032
input:
fPort: 1
bytes: [0x00, 0x00, 0xDC, 0x0F, 0x0A, 0x01, 0x00, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
bytes: [0x00, 0x00, 0xDC, 0x0F, 0x0A, 0x01, 0xFE, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
output:
data:
alarm_status:
Expand All @@ -24,4 +24,4 @@ uplinkDecoder:
values:
temperature_1:
unit: °C
value: 20.8
value: -30.4
2 changes: 1 addition & 1 deletion vendor/enless-wireless/tx-trh-amb-600-021-codec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ uplinkDecoder:
value: 28.8
temperature:
unit: °C
value: 6550.9
value: -2.7

0 comments on commit d390fb6

Please sign in to comment.