]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Fix up screen off timer of crkbd (#4346)
authorcomaid <44457151+comaid@users.noreply.github.com>
Mon, 12 Nov 2018 20:19:29 +0000 (05:19 +0900)
committerDrashna Jaelre <drashna@live.com>
Mon, 12 Nov 2018 20:19:29 +0000 (12:19 -0800)
* fix about screen off timer

* Fix Up ScreenOffInterval exceeded uint16_t

* Fix Up never waking up once screen off if in case of matrix are not dirty.

* Revert "fix about screen off timer"

This reverts commit 3d175f2340c14250a71af78afec5a1e890d9f4e7.

* Fix up screen off timer of crkbd

* Fix Up ScreenOffInterval exceeded uint16_t

* Fix Up never waking up once screen off if in case of matrix are not dirty.

* Fix up screen off timer of helix

* Fix Up ScreenOffInterval exceeded uint16_t

* Fix Up never waking up once screen off if in case of matrix are not dirty

* Revert "Fix up screen off timer of helix"

This reverts commit f0efb82443a7dc34b75579359b0514e8bfa51100.

* Improve internal processing of process_record_kb()

* Use the return value of process_record_gfx()

* Fix a indent

Fix a indent

keyboards/crkbd/crkbd.c
keyboards/crkbd/ssd1306.c
keyboards/crkbd/ssd1306.h

index 5e8ba8bacf480857d692ffe7ac9c4cd1c6febd33..32f7af776ee0b1531b6f8806b9dae6545ad5f9d8 100644 (file)
@@ -1 +1,6 @@
 #include "crkbd.h"
+#include "ssd1306.h" 
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+       return process_record_gfx(keycode,record) && process_record_user(keycode, record);
+}
\ No newline at end of file
index 205ce67a9e00fc28af59f5cdb903861e0531e06f..4330c8497db232faba2710577ca8655efe38cbe1 100644 (file)
@@ -24,12 +24,17 @@ static const unsigned char font[] PROGMEM;
 //static uint16_t last_battery_update;
 //static uint32_t vbat;
 //#define BatteryUpdateInterval 10000 /* milliseconds */
-#define ScreenOffInterval 300000 /* milliseconds */
+
+// 'last_flush' is declared as uint16_t,
+// so this must be less than 65535 
+#define ScreenOffInterval 60000 /* milliseconds */
 #if DEBUG_TO_SCREEN
 static uint8_t displaying;
 #endif
 static uint16_t last_flush;
 
+static bool force_dirty = true;
+
 // Write command sequence.
 // Returns true on success.
 static inline bool _send_cmd1(uint8_t cmd) {
@@ -321,12 +326,19 @@ void iota_gfx_task_user(void) {
 void iota_gfx_task(void) {
   iota_gfx_task_user();
 
-  if (display.dirty) {
+  if (display.dirty|| force_dirty) {
     iota_gfx_flush();
+    force_dirty = false;
   }
 
   if (timer_elapsed(last_flush) > ScreenOffInterval) {
     iota_gfx_off();
   }
 }
+
+bool process_record_gfx(uint16_t keycode, keyrecord_t *record) {
+  force_dirty = true;
+  return true;
+}
+
 #endif
index 76dd6a2a72d3d5ba473cfb75039866d73100fa80..ea8c9232805d1849591bd9bd99e6766cf085675d 100644 (file)
@@ -3,6 +3,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include "pincontrol.h"
+#include "action.h"
 
 enum ssd1306_cmds {
   DisplayOff = 0xAE,
@@ -86,3 +87,5 @@ void matrix_write(struct CharacterMatrix *matrix, const char *data);
 void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
 void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
 void matrix_render(struct CharacterMatrix *matrix);
+
+bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
\ No newline at end of file