mirror of
https://github.com/compute-blade-community/compute-blade-agent.git
synced 2026-04-16 15:35:42 +02:00
* chore: update repository references from uptime-industries to compute-blade-community chore: update repository references from uptime-industries to compute-blade-community for consistency and clarity across all files fix: update links in CHANGELOG.md and README.md to point to the new repository location for accurate documentation fix: update Dockerfile and systemd service file to reflect the new repository URL for proper source tracking refactor: change import paths in Go files to use the new repository name for correct package referencing * chore: Add CODEOWNERS * feat: add auto-labeling --------- Co-authored-by: Cedric Kienzler <cedric@specht-labs.de>
22 lines
536 B
Go
22 lines
536 B
Go
package smartfanunit
|
|
|
|
import "github.com/compute-blade-community/compute-blade-agent/pkg/smartfanunit/proto"
|
|
|
|
func float32To24Bit(val float32) proto.Data {
|
|
// Convert float32 to number with 3 bytes (0.1 precision)
|
|
tmp := uint32(val * 10)
|
|
if tmp > 0xffffff {
|
|
tmp = 0xffffff // cap
|
|
}
|
|
return proto.Data{
|
|
uint8((tmp >> 16) & 0xFF),
|
|
uint8((tmp >> 8) & 0xFF),
|
|
uint8(tmp & 0xFF),
|
|
}
|
|
}
|
|
|
|
func float32From24Bit(data proto.Data) float32 {
|
|
tmp := uint32(data[0])<<16 | uint32(data[1])<<8 | uint32(data[2])
|
|
return float32(tmp) / 10
|
|
}
|