LincolnG4 / GoMDF

ASAM MDF / MF4 (Measurement Data Format) files editor in GoLang
MIT License
9 stars 0 forks source link

The mf4.ReadFile method prints the comment by default, is it possible to add a token to control whether it needs to be printed or not? #23

Closed Nmoumou closed 8 months ago

Nmoumou commented 9 months ago

image Excuse me, as you can see above, in command line usage, it is sometimes necessary to keep the output concise. I see out output function in source mf4/mf4.go at line 75 etc, is it possible to add markers to control the output of these values?

LincolnG4 commented 9 months ago

Sure. I will remove all those prints. It was made just to help me to debug and to study the mf4 files. In next the push they will not be there

LincolnG4 commented 9 months ago

@Nmoumou I released a quick fix for this issue, I removed all unnecessary debug prints from the package and it should solve the issue from your side.

go get -u github.com/LincolnG4/GoMDF

make sure you are using version v0.0.2

Please update the package and let me know if you have any problem, otherwise please close the issue :) .

Nmoumou commented 9 months ago

@LincolnG4 Sorry for the late verification, I think the new version failed to compile for me because of the introduction of this library github.com/Pramod-Devireddy/go-exprtk, have you encountered this problem? image

LincolnG4 commented 9 months ago

@Nmoumou sorry the delay

Yes I could build and run it normally Screenshot from 2024-01-25 23-08-47

Could you send me your code and go.mod ??

code that I built

package main

import (
    "fmt"
    "os"

    mf4 "github.com/LincolnG4/GoMDF/mf4"
)

func main() {
    file, err := os.Open("sample3.mf4")
    if err != nil {
        panic(err)
    }

    m, err := mf4.ReadFile(file)
    if err != nil {
        panic(err)
    }
    // Access metadata
    fmt.Println(m.Version())
    fmt.Println("Version ID --> ", m.MdfVersion())
    fmt.Println("Start Time NS --> ", m.GetStartTimeNs())
    fmt.Println("Start StartTimeLT --> ", m.GetStartTimeLT())

    // Get channel samples
    fmt.Println(m.ChannelNames())
    samples, err := m.GetChannelSample(0, "ActlEngPrcntTorqueHighResolution")
    if err != nil {
        panic(err)
    }
    fmt.Println(samples)
    // Download attachments
    // att := m.GetAttachments()[0]
    // m.SaveAttachment(att, "/PATH/TO/BE/SAVE/")

    // Read Change logs
    m.ReadChangeLog()
}

my go.mod

module mdf-reader

go 1.21

toolchain go1.21.4

require github.com/LincolnG4/GoMDF v0.0.2

require (
    github.com/Pramod-Devireddy/go-exprtk v1.1.0 // indirect
    github.com/davecgh/go-spew v1.1.1 // indirect
)
Nmoumou commented 9 months ago

Ok, let me check my environment, I'll close the problem first, thanks a lot!

LincolnG4 commented 9 months ago

@Nmoumou Keep me updated about your issue. Just let me know if I can help you with something

LincolnG4 commented 9 months ago

Hi @Nmoumou I'm opening the issue again. As I mentioned, in my Linux PC the code built fine but today I tried to build in a Windows machine and I could replicate your issue. Looks like the go-exprt package has some issues to compile on Windows. I will work to migrate to a new package

Nmoumou commented 9 months ago

@LincolnG4 Yes, there is a problem with go-exprtk v1.1.0 on Windows, I've migrated the environment to linux, so it's fine

LincolnG4 commented 8 months ago

@Nmoumou I migrated the package and now is compiling on windows