Skip to content

Commit

Permalink
gofumpt formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
SchumacherFM committed Mar 24, 2024
1 parent 892a503 commit 773d5c1
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 66 deletions.
1 change: 0 additions & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"syscall"
"time"


"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
Expand Down
2 changes: 1 addition & 1 deletion meters/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

// DeviceDescriptor describes a device
type DeviceDescriptor struct {
Name string
Name string
Type string
Manufacturer string
Model string
Expand Down
13 changes: 6 additions & 7 deletions meters/rs485/orno1p.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ func NewORNO1PProducer() Producer {
ApparentPower: 0x156, // 32 bit, 0.001kva
Cosphi: 0x15B, // 16 bit, 0.001

Sum: 0xA000, //32 Bit, 0.01kwh
SumT1: 0xA002, //32 Bit, 0.01kwh
SumT2: 0xA004, //32 Bit, 0.01kwh
Sum: 0xA000, // 32 Bit, 0.01kwh
SumT1: 0xA002, // 32 Bit, 0.01kwh
SumT2: 0xA004, // 32 Bit, 0.01kwh
// SumT3: 0xA006, //32 Bit, 0.01kwh // currently not supported
// SumT4: 0xA008, //32 Bit, 0.01kwh // currently not supported
ReactiveSum: 0xA01E, //32 Bit, 0.01kvarh
ReactiveSumT1: 0xA020, //32 Bit, 0.01kvarh
ReactiveSumT2: 0xA022, //32 Bit, 0.01kvarh
ReactiveSum: 0xA01E, // 32 Bit, 0.01kvarh
ReactiveSumT1: 0xA020, // 32 Bit, 0.01kvarh
ReactiveSumT2: 0xA022, // 32 Bit, 0.01kvarh
// ReactiveSumT3: 0xA024, //32 Bit, 0.01kvarh // currently not supported
// ReactiveSumT4: 0xA026, //32 Bit, 0.01kvarh // currently not supported
}
Expand Down Expand Up @@ -104,7 +104,6 @@ func (p *ORNO1PProducer) Probe() Operation {

// Produce implements Producer interface
func (p *ORNO1PProducer) Produce() (res []Operation) {

for _, op := range []Measurement{
VoltageL1,
Frequency,
Expand Down
5 changes: 2 additions & 3 deletions meters/rs485/orno1p504.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ func init() {
}

var ops1p504 Opcodes = Opcodes{

Frequency: 0x02, // 16 bit, Hz
Voltage: 0x00, // 16 bit, V
Current: 0x01, // 16 bit, A
Expand All @@ -16,8 +15,8 @@ var ops1p504 Opcodes = Opcodes{
ApparentPower: 0x05, // 16 bit, va
Cosphi: 0x06, // 16 bit,

Sum: 0x07, //32 Bit, wh
ReactiveSum: 0x09, //32 Bit, varh
Sum: 0x07, // 32 Bit, wh
ReactiveSum: 0x09, // 32 Bit, varh
}

type ORNO1P504Producer struct {
Expand Down
86 changes: 43 additions & 43 deletions meters/rs485/orno3p.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,49 +44,49 @@ func NewORNO3PProducer() Producer {
ApparentPower: 0x002C, // 32 bit, kva
Cosphi: 0x0034, // 32 bit, XX,X(literal)

Sum: 0x0100, //32 Bit, kwh
SumL1: 0x0102, //32 Bit, kwh
SumL2: 0x0104, //32 Bit, kwh
SumL3: 0x0106, //32 Bit, kwh

Import: 0x0108, //32 Bit, kwh
ImportL1: 0x010A, //32 Bit, kwh
ImportL2: 0x010C, //32 Bit, kwh
ImportL3: 0x010E, //32 Bit, kwh

Export: 0x0110, //32 Bit, kwh
ExportL1: 0x0112, //32 Bit, kwh
ExportL2: 0x0114, //32 Bit, kwh
ExportL3: 0x0116, //32 Bit, kwh

ReactiveSum: 0x0118, //32 Bit, kvarh
ReactiveSumL1: 0x011A, //32 Bit, kvarh
ReactiveSumL2: 0x011C, //32 Bit, kvarh
ReactiveSumL3: 0x011E, //32 Bit, kvarh

ReactiveImport: 0x0120, //32 Bit, kvarh
ReactiveImportL1: 0x0122, //32 Bit, kvarh
ReactiveImportL2: 0x0124, //32 Bit, kvarh
ReactiveImportL3: 0x0126, //32 Bit, kvarh

ReactiveExport: 0x0128, //32 Bit, kvarh
ReactiveExportL1: 0x012A, //32 Bit, kvarh
ReactiveExportL2: 0x012C, //32 Bit, kvarh
ReactiveExportL3: 0x012E, //32 Bit, kvarh

SumT1: 0x0130, //32 Bit, kwh
ImportT1: 0x0132, //32 Bit, kwh
ExportT1: 0x0134, //32 Bit, kwh
ReactiveSumT1: 0x0136, //32 Bit, kvarh
ReactiveImportT1: 0x0138, //32 Bit, kvarh
ReactiveExportT1: 0x013A, //32 Bit, kvarh

SumT2: 0x013C, //32 Bit, kwh
ImportT2: 0x013E, //32 Bit, kwh
ExportT2: 0x0140, //32 Bit, kwh
ReactiveSumT2: 0x0142, //32 Bit, kvarh
ReactiveImportT2: 0x0144, //32 Bit, kvarh
ReactiveExportT2: 0x0146, //32 Bit, kvarh
Sum: 0x0100, // 32 Bit, kwh
SumL1: 0x0102, // 32 Bit, kwh
SumL2: 0x0104, // 32 Bit, kwh
SumL3: 0x0106, // 32 Bit, kwh

Import: 0x0108, // 32 Bit, kwh
ImportL1: 0x010A, // 32 Bit, kwh
ImportL2: 0x010C, // 32 Bit, kwh
ImportL3: 0x010E, // 32 Bit, kwh

Export: 0x0110, // 32 Bit, kwh
ExportL1: 0x0112, // 32 Bit, kwh
ExportL2: 0x0114, // 32 Bit, kwh
ExportL3: 0x0116, // 32 Bit, kwh

ReactiveSum: 0x0118, // 32 Bit, kvarh
ReactiveSumL1: 0x011A, // 32 Bit, kvarh
ReactiveSumL2: 0x011C, // 32 Bit, kvarh
ReactiveSumL3: 0x011E, // 32 Bit, kvarh

ReactiveImport: 0x0120, // 32 Bit, kvarh
ReactiveImportL1: 0x0122, // 32 Bit, kvarh
ReactiveImportL2: 0x0124, // 32 Bit, kvarh
ReactiveImportL3: 0x0126, // 32 Bit, kvarh

ReactiveExport: 0x0128, // 32 Bit, kvarh
ReactiveExportL1: 0x012A, // 32 Bit, kvarh
ReactiveExportL2: 0x012C, // 32 Bit, kvarh
ReactiveExportL3: 0x012E, // 32 Bit, kvarh

SumT1: 0x0130, // 32 Bit, kwh
ImportT1: 0x0132, // 32 Bit, kwh
ExportT1: 0x0134, // 32 Bit, kwh
ReactiveSumT1: 0x0136, // 32 Bit, kvarh
ReactiveImportT1: 0x0138, // 32 Bit, kvarh
ReactiveExportT1: 0x013A, // 32 Bit, kvarh

SumT2: 0x013C, // 32 Bit, kwh
ImportT2: 0x013E, // 32 Bit, kwh
ExportT2: 0x0140, // 32 Bit, kwh
ReactiveSumT2: 0x0142, // 32 Bit, kvarh
ReactiveImportT2: 0x0144, // 32 Bit, kvarh
ReactiveExportT2: 0x0146, // 32 Bit, kvarh

/* // Curently not supported
SumT3: 0x0148, //32 Bit, kwh
Expand Down
10 changes: 5 additions & 5 deletions meters/rs485/sdm.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ func NewSDMProducer() Producer {
THDL3: 0x00ee, // voltage
THD: 0x00F8, // voltage
Frequency: 0x0046, // 230
//L1THDCurrent: 0x00F0, // current
//L2THDCurrent: 0x00F2, // current
//L3THDCurrent: 0x00F4, // current
//AvgTHDCurrent: 0x00Fa, // current
//ApparentImportPower: 0x0064,
// L1THDCurrent: 0x00F0, // current
// L2THDCurrent: 0x00F2, // current
// L3THDCurrent: 0x00F4, // current
// AvgTHDCurrent: 0x00Fa, // current
// ApparentImportPower: 0x0064,
}
return &SDMProducer{Opcodes: ops}
}
Expand Down
11 changes: 5 additions & 6 deletions meters/units/units_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
)

func Test_makeInternalUnit(t *testing.T) {
internalUnit :=
newInternalUnit(
Ampere,
withName("Ampere", ""),
withAbbreviation("A", ""),
)
internalUnit := newInternalUnit(
Ampere,
withName("Ampere", ""),
withAbbreviation("A", ""),
)

if internalUnit.name.Singular != "Ampere" {
t.Errorf(
Expand Down

0 comments on commit 773d5c1

Please sign in to comment.