Scales Integration

Wherever SambaPOS was installed. Default is "%PROGRAMFILES(X86)%\SambaPOS5"

I specified x86 for this build. See if this works.

BT.SambaModules.MettlerToledoVivaScale_0.9.0.0.zip (25.3 KB)

and now the forum is throwing shade :rofl:

image

1 Like

It doesnā€™t show up for some reason?

I donā€™t know what to tell you. I throw the modules in the programā€™s install directory and theyā€™re just there.

5.3.0
image

5.3.6 fresh install in VM
image

image

I see you donā€™t have the other scales in your list, Iā€™ll uninstall those then see what happens. :+1:

It feels so close to being complete.

He may need to right click the dll go to properties and unblock it

1 Like

@Jesse is correct, you have to unblock the dll.

image

With the the addon and the the mettler library copied locally:

image

With the mettler library downloaded from the forum:

image

and unblocked

image

That has worked!!!
I couldnā€™t unblock the file whilst it was in the SambaPOS folder ( I received an error about semaphores etc). Anyway I unblocked it in the download folder OK then copied it over.

I have added the scale and it kind of works. Itā€™s cutting off some figures, e.g. 0.580 is showing up as 0.5.

Log file attached.

scale_log.zip (892 Bytes)

For the one that shows ā€œ0.5ā€ when it should be ā€œ0.580ā€ the raw data received from the scale shows ā€œ0.5ā€

2022-05-17 09:30:55.184 [DEBUG] Raw received: [0.5]

Line 208 gets the raw data from the serial port and line 212 logs it before any regex/transformation has happened
image

I did notice in the log decimals without a leading 0 which wonā€™t match the regex pattern. But in the test data you collected for me, the weights always had a leading zero.

As you can see towards the end, decimals without a leading zero arenā€™t matched.

2022-05-16_17;05_1652742312_firefox

I added some log entries to help me see when things begin and end so please keep debug logging enabled. Thanks!

I switched back to reading the actual bytes then converting to string. Weā€™ll see if that changes things so give this a try:

BT.SambaModules.MettlerToledoVivaScale_0.9.0.1.zip (25.9 KB)

New log file attached. On a few occasions I had to press the ā€˜Scaleā€™ button (the one I created to send the W) before something came up. The .62 should have been .625

Getting close :smiley:

no log file in your post

On a few occasions I had to press the ā€˜Scaleā€™ button

Thatā€™s how it has to work. You press the scale button, then it sends the init string, then the scale responds.

Lol, I meant to say 'press the ā€˜Scaleā€™ button twice. Nothing would come up the first time.

Log file attached this time.

scale_log (2).zip (1.8 KB)

I was sending a CR even if the setting wasnā€™t enabled. Iā€™m not sure if that was causing the scale to not know what the POS was asking. Oops.

I see this for .625 which wouldnā€™t match and doesnā€™t end with the char specified in the docs.

2022-05-17 13:01:47.369  [DEBUG]  HEX string: [2E 36 32 35 0D 02 3F]
2022-05-17 13:01:47.371  [DEBUG]  Decoded bytes: [.625
?]

a second later, thereā€™s this

2022-05-17 13:01:48.411  [DEBUG]  HEX string: [30 2E 36 32 35 0D 02]
2022-05-17 13:01:48.413  [DEBUG]  Decoded bytes: [0.625
]

which matches the regex and ends with the proper char

Give this build a shot and send me the log again, please.

BT.SambaModules.MettlerToledoVivaScale_0.9.0.2.zip (26.0 KB)

Looking good :+1:t2:

Only a couple of times I had to press the scale button twice.

Log file attached.
scale_log (4).zip (2.4 KB)

the one you had to click the scale button twice, was that for the item that weighs 4.485?

I believe so, yes, that is correct. :+1:t2:

Okay, I think I understand whatā€™s going on.

The initial response

2022-05-17 14:52:57.360  [DEBUG]  HEX string: [02 30 34]
2022-05-17 14:52:57.362  [DEBUG]  Decoded bytes: [04]`

code preview isnā€™t showing STX (hex/char 02)
image

Seems to match up with seems to be the status byte which the docs say has to be converted to binary.

Let me work on this and Iā€™ll let you know.

Logging added for processing the status byte and parsing the individual bits for the status.

For the last weigh before you upload the log, do a negative weight if you can. I want to see the output.

BT.SambaModules.MettlerToledoVivaScale_0.9.0.3.zip (27.4 KB)

Forgot to reverse the binary string when checking the bits. Arrays start at 0 on the left, but binary bits start at 0 on the right.

latest build

BT.SambaModules.MettlerToledoVivaScale_0.9.0.4.zip (27.5 KB)

0.9.0.4 crashes the system so Iā€™ve reverted back. I pressed ā€˜Scaleā€™, nothing seemed to be happening for about 5 seconds then SambaPOS just closed.

Log file attached.
scale_log (5).zip (2.7 KB)

Could you send the crash exception from the POS log. I donā€™t have any try/catch blocks as Iā€™m punting to the appā€™s handler.