Skip to content

Commit

Permalink
Renamings, shorter, hopefully better understandable
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte Muench committed Jul 28, 2024
1 parent 67c8f2c commit d6ee08c
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package convertfunctions
package convertmode

import (
"encoding/hex"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package convertfunctions
package convertmode

import (
"encoding/binary"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package convertfunctions
package convertmode

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion src/convertfunctions/none.go → src/convertmode/none.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package convertfunctions
package convertmode

import "github.com/brutella/can"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package convertfunctions
package convertmode

import (
"github.com/brutella/can"
Expand Down Expand Up @@ -195,4 +195,4 @@ func FuzzNoneToMqtt(f *testing.F) {
}

})
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package convertfunctions
package convertmode

import (
"encoding/hex"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package convertfunctions
package convertmode

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package convertfunctions
package convertmode

import (
"encoding/binary"
Expand Down
18 changes: 9 additions & 9 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bufio" // Reader
"encoding/csv" // CSV Management
"flag"
"github.com/c3re/can2mqtt/convertfunctions"
"github.com/c3re/can2mqtt/convertmode"
"io" // EOF const
"log" // error management
"log/slog"
Expand Down Expand Up @@ -67,20 +67,20 @@ func readC2MPFromFile(filename string) {
convertModeFromString = make(map[string]ConvertMode)

// initialize all convertModes
convertModeFromString["none"] = convertfunctions.None{}
convertModeFromString["16bool2ascii"] = convertfunctions.SixteenBool2Ascii{}
convertModeFromString["pixelbin2ascii"] = convertfunctions.PixelBin2Ascii{}
convertModeFromString["bytecolor2colorcode"] = convertfunctions.ByteColor2ColorCode{}
convertModeFromString["mymode"] = convertfunctions.MyMode{}
// Dynamically create int and uint convertmodes
convertModeFromString["none"] = convertmode.None{}
convertModeFromString["16bool2ascii"] = convertmode.SixteenBool2Ascii{}
convertModeFromString["pixelbin2ascii"] = convertmode.PixelBin2Ascii{}
convertModeFromString["bytecolor2colorcode"] = convertmode.ByteColor2ColorCode{}
convertModeFromString["mymode"] = convertmode.MyMode{}
// Dynamically create int and uint convertmode
for _, bits := range []uint{8, 16, 32, 64} {
for _, instances := range []uint{1, 2, 4, 8} {
if bits*instances <= 64 {
// int
cmi, _ := convertfunctions.NewInt2Ascii(instances, bits)
cmi, _ := convertmode.NewInt2Ascii(instances, bits)
convertModeFromString[cmi.String()] = cmi
// uint
cmu, _ := convertfunctions.NewUint2Ascii(instances, bits)
cmu, _ := convertmode.NewUint2Ascii(instances, bits)
convertModeFromString[cmu.String()] = cmu
}
}
Expand Down
File renamed without changes.

0 comments on commit d6ee08c

Please sign in to comment.