fix(pkg/sensor): use context to terminate go routines
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
|
||||
var compression bool
|
||||
var logs bool
|
||||
var round float64
|
||||
|
||||
var readTemperatureCmd = &cobra.Command{
|
||||
Use: "read",
|
||||
@ -35,8 +36,7 @@ var readTemperatureCmd = &cobra.Command{
|
||||
temperatureSensors = cnf.GetTemperatureSensorsByName(args)
|
||||
}
|
||||
|
||||
// read temperature from sensors
|
||||
temperatures, err := sensor.ReadTemperatures(temperatureSensors)
|
||||
temperatures, err := sensor.ReadTemperatures(temperatureSensors, round)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
@ -55,6 +55,7 @@ var readTemperatureCmd = &cobra.Command{
|
||||
|
||||
func init() {
|
||||
temperatureCmd.AddCommand(readTemperatureCmd)
|
||||
readTemperatureCmd.Flags().BoolVarP(&logs, "logs", "l", true, "Log temperature")
|
||||
readTemperatureCmd.Flags().BoolVarP(&compression, "compression", "c", true, "Compress measured with logged temperatures")
|
||||
readTemperatureCmd.Flags().BoolVar(&logs, "logs", true, "Log temperature")
|
||||
readTemperatureCmd.Flags().BoolVar(&compression, "compression", true, "Compress measured with logged temperatures")
|
||||
readTemperatureCmd.Flags().Float64VarP(&round, "round", "r", 0.25, "Round values. The value 0 deactivates the function")
|
||||
}
|
||||
|
Reference in New Issue
Block a user