Reuse redraws to decrease cpu load
This commit is contained in:
+2
-1
@@ -36,6 +36,7 @@ const CAN_ID_06C = 0x06C
|
|||||||
const CAN_ID_061 = 0x061
|
const CAN_ID_061 = 0x061
|
||||||
const CAN_ID_062 = 0x062
|
const CAN_ID_062 = 0x062
|
||||||
const CAN_ID_065 = 0x065
|
const CAN_ID_065 = 0x065
|
||||||
|
const bufferSize = 100
|
||||||
|
|
||||||
type CanFrame struct {
|
type CanFrame struct {
|
||||||
CanId uint32
|
CanId uint32
|
||||||
@@ -159,7 +160,7 @@ func StartCan(canbus string) (<-chan *CanFrame, error) {
|
|||||||
|
|
||||||
if cerr := socket.Bind(canbus, filter); cerr == nil {
|
if cerr := socket.Bind(canbus, filter); cerr == nil {
|
||||||
|
|
||||||
canevents := make(chan *CanFrame)
|
canevents := make(chan *CanFrame, bufferSize)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer close(canevents)
|
defer close(canevents)
|
||||||
|
|||||||
+1
-1
@@ -52,7 +52,7 @@ func main() {
|
|||||||
|
|
||||||
display.Start()
|
display.Start()
|
||||||
|
|
||||||
updates := make(chan *yabl.Event)
|
updates := make(chan *yabl.Event, 1000)
|
||||||
|
|
||||||
var f func()
|
var f func()
|
||||||
f = func() {
|
f = func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user