diff options
| author | comaid <44457151+comaid@users.noreply.github.com> | 2018-11-13 05:19:29 +0900 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2018-11-12 12:19:29 -0800 |
| commit | aa03049015855cdd5f61e6e8a7c6955abc5d3141 (patch) | |
| tree | c63eb623ddb31e454dabef738ce6be16410b77cb | |
| parent | b1e74aee43596e2601248b0a78b2c54c897ce78b (diff) | |
| download | qmk_firmware-aa03049015855cdd5f61e6e8a7c6955abc5d3141.tar.gz qmk_firmware-aa03049015855cdd5f61e6e8a7c6955abc5d3141.zip | |
Fix up screen off timer of crkbd (#4346)
* 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
| -rw-r--r-- | keyboards/crkbd/crkbd.c | 5 | ||||
| -rw-r--r-- | keyboards/crkbd/ssd1306.c | 16 | ||||
| -rw-r--r-- | keyboards/crkbd/ssd1306.h | 3 |
3 files changed, 22 insertions, 2 deletions
diff --git a/keyboards/crkbd/crkbd.c b/keyboards/crkbd/crkbd.c index 5e8ba8bac..32f7af776 100644 --- a/keyboards/crkbd/crkbd.c +++ b/keyboards/crkbd/crkbd.c | |||
| @@ -1 +1,6 @@ | |||
| 1 | #include "crkbd.h" | 1 | #include "crkbd.h" |
| 2 | #include "ssd1306.h" | ||
| 3 | |||
| 4 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||
| 5 | return process_record_gfx(keycode,record) && process_record_user(keycode, record); | ||
| 6 | } \ No newline at end of file | ||
diff --git a/keyboards/crkbd/ssd1306.c b/keyboards/crkbd/ssd1306.c index 205ce67a9..4330c8497 100644 --- a/keyboards/crkbd/ssd1306.c +++ b/keyboards/crkbd/ssd1306.c | |||
| @@ -24,12 +24,17 @@ static const unsigned char font[] PROGMEM; | |||
| 24 | //static uint16_t last_battery_update; | 24 | //static uint16_t last_battery_update; |
| 25 | //static uint32_t vbat; | 25 | //static uint32_t vbat; |
| 26 | //#define BatteryUpdateInterval 10000 /* milliseconds */ | 26 | //#define BatteryUpdateInterval 10000 /* milliseconds */ |
| 27 | #define ScreenOffInterval 300000 /* milliseconds */ | 27 | |
| 28 | // 'last_flush' is declared as uint16_t, | ||
| 29 | // so this must be less than 65535 | ||
| 30 | #define ScreenOffInterval 60000 /* milliseconds */ | ||
| 28 | #if DEBUG_TO_SCREEN | 31 | #if DEBUG_TO_SCREEN |
| 29 | static uint8_t displaying; | 32 | static uint8_t displaying; |
| 30 | #endif | 33 | #endif |
| 31 | static uint16_t last_flush; | 34 | static uint16_t last_flush; |
| 32 | 35 | ||
| 36 | static bool force_dirty = true; | ||
| 37 | |||
| 33 | // Write command sequence. | 38 | // Write command sequence. |
| 34 | // Returns true on success. | 39 | // Returns true on success. |
| 35 | static inline bool _send_cmd1(uint8_t cmd) { | 40 | static inline bool _send_cmd1(uint8_t cmd) { |
| @@ -321,12 +326,19 @@ void iota_gfx_task_user(void) { | |||
| 321 | void iota_gfx_task(void) { | 326 | void iota_gfx_task(void) { |
| 322 | iota_gfx_task_user(); | 327 | iota_gfx_task_user(); |
| 323 | 328 | ||
| 324 | if (display.dirty) { | 329 | if (display.dirty|| force_dirty) { |
| 325 | iota_gfx_flush(); | 330 | iota_gfx_flush(); |
| 331 | force_dirty = false; | ||
| 326 | } | 332 | } |
| 327 | 333 | ||
| 328 | if (timer_elapsed(last_flush) > ScreenOffInterval) { | 334 | if (timer_elapsed(last_flush) > ScreenOffInterval) { |
| 329 | iota_gfx_off(); | 335 | iota_gfx_off(); |
| 330 | } | 336 | } |
| 331 | } | 337 | } |
| 338 | |||
| 339 | bool process_record_gfx(uint16_t keycode, keyrecord_t *record) { | ||
| 340 | force_dirty = true; | ||
| 341 | return true; | ||
| 342 | } | ||
| 343 | |||
| 332 | #endif | 344 | #endif |
diff --git a/keyboards/crkbd/ssd1306.h b/keyboards/crkbd/ssd1306.h index 76dd6a2a7..ea8c92328 100644 --- a/keyboards/crkbd/ssd1306.h +++ b/keyboards/crkbd/ssd1306.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
| 4 | #include <stdio.h> | 4 | #include <stdio.h> |
| 5 | #include "pincontrol.h" | 5 | #include "pincontrol.h" |
| 6 | #include "action.h" | ||
| 6 | 7 | ||
| 7 | enum ssd1306_cmds { | 8 | enum ssd1306_cmds { |
| 8 | DisplayOff = 0xAE, | 9 | DisplayOff = 0xAE, |
| @@ -86,3 +87,5 @@ void matrix_write(struct CharacterMatrix *matrix, const char *data); | |||
| 86 | void matrix_write_ln(struct CharacterMatrix *matrix, const char *data); | 87 | void matrix_write_ln(struct CharacterMatrix *matrix, const char *data); |
| 87 | void matrix_write_P(struct CharacterMatrix *matrix, const char *data); | 88 | void matrix_write_P(struct CharacterMatrix *matrix, const char *data); |
| 88 | void matrix_render(struct CharacterMatrix *matrix); | 89 | void matrix_render(struct CharacterMatrix *matrix); |
| 90 | |||
| 91 | bool process_record_gfx(uint16_t keycode, keyrecord_t *record); \ No newline at end of file | ||
