DSP Output CSV1 clear data

Any bugs you encounter with Flowcode should be discussed here.
stefan.erni
Valued Contributor
Posts: 758
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

DSP Output CSV1 clear data

Post by stefan.erni »

Hi Ben

I am trying to build a pressure sensor for 50Kg.
For this I test first with a 500G sensor because it is much easier to load 500G than 50Kg.
I'm testing different HX711 boards. Everything works fine.

But with the DSP Output CSV there are small problems with the clear data. I can save the data to an existing dsp.csv ffile but I cannot delete and rewrite an existing file. (clear data)

It would also be easier if the file name could be selected with a command.

regards

Stefan

hx711_2022-09-27_11-10-51.jpg
hx711_2022-09-27_11-10-51.jpg (51.02 KiB) Viewed 1774 times
Test_IMG_0859.JPEG
Test_IMG_0859.JPEG (103.74 KiB) Viewed 1774 times
Demo_ESP32_post_hx711_sd.fcfx
(66.64 KiB) Downloaded 56 times

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: DSP Output CSV1 clear data

Post by BenR »

Hi Stefan,

I've looked into the file not being overwritten problem and it all looks to be ok, or at least it certainly should be happening. Can you tell me if the problem you're seeing is in the simulation or on hardware or both?

I've added in new macros to allow the file to be opened and closed, by default the file you have selected via the properties will be automatically opened when calling WriteValue but you can also close and open another file at any point if you wish.

Also added similar improvements to the DSP File Input component.

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: DSP Output CSV1 clear data

Post by stefan.erni »

Hi Ben

Very good. Thanks.
I have adjusted the program but I get a "failed".
to understand the error message it's not simpel...

I only use the hardware.

regards

Stefan
Attachments
Demo_ESP32_post_hx711_sd.fcfx
(68.61 KiB) Downloaded 55 times

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: DSP Output CSV1 clear data

Post by BenR »

Hi Stefan,

Thanks for letting me know, it should compile correctly for you now.

I'll investigate why deleting the file on the ESP isn't working.

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: DSP Output CSV1 clear data

Post by stefan.erni »

Hi Ben

It's working but

Test1 (append)
I use append and made 3 recording. The first record I pressed 1x, second record I pressed 2x and the last I pressed 3x
result:
The first record is not recorded, Maybe it just creat the file, but the another two recording was saved ok.

Test2 (clear)
Again I made 3 recording with a new filename. The first record I pressed 1x, second record i pressed 2x and the last I pressed 3x
result:
The CSV file exist but empty (clear?)

But one more question. These propertis are no longer usable, no influence?


regards

Stefan
Frage_2022-09-28_16-22-18.jpg
Frage_2022-09-28_16-22-18.jpg (33.77 KiB) Viewed 1757 times
Attachments
app_2022-09-28_15-58-04.jpg
app_2022-09-28_15-58-04.jpg (31.75 KiB) Viewed 1757 times

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: DSP Output CSV1 clear data

Post by BenR »

Hi Stefan,

Thanks I'll investigate for you and see what I find. Could be the ESP is going at a rate of knots and something is too fast or needs a delay to relibly perform the log. Sounds like directly after creating the file the log doesn't work. The clear operation basically deletes the file and then recreates each time you open the file. The OpenFile macro has a new return value so you could look at this to report the state of the operation. You could also try opening the file in clear mode to delete the file and then open the file again in append mode and hopefully it will then accept the data you put into it.

The two properties you highlighted (Filename and Existing Data) are the defaults, so prior to calling OpenFile in your program then these are the values that will be used and OpenFile will be called for you behind the scenes by the component. If you do call OpenFile then that will then override the defaults. Layout is always being used though we might want to try and make this a variable feature too.

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: DSP Output CSV1 clear data

Post by stefan.erni »

Hi Ben

Now that I can set the filename, I don't need the clear function. I just make a new file. I can make the new file open/close and then open again, write data and close the file.

So I can use the DSPcsv very well for the calibration and simply have a Excel data file

But unfortunately later I have two HX711.
Is there a possibility for two or more rows with the DSPcsv in the future?

regards

Stefan

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: DSP Output CSV1 clear data

Post by BenR »

Hi Stefan,

Yes that certainly would be nice, I have an idea on how to do it so I'll see what I can do.

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: DSP Output CSV1 clear data

Post by stefan.erni »

Hi Ben

That would be great!

Something like that maybe...
and later also a WAV file with a choice of channels

regards


Stefan

csv_2022-09-30_14-40-38.jpg
csv_2022-09-30_14-40-38.jpg (37.56 KiB) Viewed 1712 times
csv___2022-09-30_14-40-38.jpg
csv___2022-09-30_14-40-38.jpg (13.34 KiB) Viewed 1712 times

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: DSP Output CSV1 clear data

Post by BenR »

Hi Stefan,

Do you have access to the v10 beta, I might make the changes there as I'm doing some DSP work for v10 anyway.

This is what I have so far but it's not quite ready yet.
CSV.jpg
CSV.jpg (12.49 KiB) Viewed 1710 times

The input would read a row from the CSV and put the first column into the top buffer, the second into the second etc. On the next pass we would skip through the file until we get to the start of the next row and then start again.

The output would do a similar job, each write would write a row into the CSV by taking a value from each buffer in turn to write each column entry.

Post Reply