File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed
hardware/riot/ports/controllers Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -37,19 +37,16 @@ func newLazyLog(val *Lazy) *LazyLog {
3737}
3838
3939func (lz * LazyLog ) update () {
40- lz .val .Dbg .PushRawEvent (func () {
40+ // when making a copy of the log we only want to do it if the log has been
41+ // dirtied. to do this we need to note the timestamp of the most recent log
42+ // entry so we can pass it to the logger.Copy() function
43+ timestamp := time .Unix (0 , 0 )
44+ if len (lz .Log ) > 0 {
45+ timestamp = lz .Log [len (lz .Log )- 1 ].Timestamp
46+ }
4147
42- // make a copy of the log. the logger.Copy() function requires a
43- // timestamp of the most recent log entry. the Copy() function uses
44- // this to decide whether a new copy is required. if the Copy()
45- // function return nil then we'll just coninue to use the old copy
46- var ref time.Time
47- if len (lz .Log ) > 0 {
48- ref = lz .Log [len (lz .Log )- 1 ].Timestamp
49- } else {
50- ref = time .Unix (0 , 0 )
51- }
52- if l := logger .Copy (ref ); l != nil {
48+ lz .val .Dbg .PushRawEvent (func () {
49+ if l := logger .Copy (timestamp ); l != nil {
5350 lz .atomicLog .Store (l )
5451 lz .atomicDirty .Store (true )
5552 } else {
Original file line number Diff line number Diff line change @@ -18,4 +18,4 @@ package controllers
1818// ControllerList is the list of controllers. These are the values that can be
1919// returned by the ID() function of the ports.Peripheral implementations in
2020// this package
21- var ControllerList = []string {"Auto" , " Stick" , "Paddle" , "Keyboard" }
21+ var ControllerList = []string {"Stick" , "Paddle" , "Keyboard" }
You can’t perform that action at this time.
0 commit comments