]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - keyboards/crkbd/ssd1306.c
[Keyboard] Snagpad Configurator bugfix and readme refactor (#6381)
[qmk_firmware.git] / keyboards / crkbd / ssd1306.c
index 205ce67a9e00fc28af59f5cdb903861e0531e06f..20c2738db774d0d02bf21aa0bcf5228364b98c36 100644 (file)
@@ -13,7 +13,7 @@
 #include "sendchar.h"
 #include "timer.h"
 
-static const unsigned char font[] PROGMEM;
+extern const unsigned char font[] PROGMEM;
 
 // Set this to 1 to help diagnose early startup problems
 // when testing power-on with ble.  Turn it off otherwise,
@@ -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