Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]Fix up screen off timer of helix #4347

Merged
merged 7 commits into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions keyboards/helix/pico/pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@


#ifdef SSD1306OLED
#include "ssd1306.h"

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_gfx(keycode,record) && process_record_user(keycode, record);
}

void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
//led_set_user(usb_led);
Expand Down
6 changes: 6 additions & 0 deletions keyboards/helix/rev1/rev1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@


#ifdef SSD1306OLED
#include "ssd1306.h"

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_gfx(keycode,record) && process_record_user(keycode, record);
}

void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led);
Expand Down
6 changes: 6 additions & 0 deletions keyboards/helix/rev2/rev2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@


#ifdef SSD1306OLED
#include "ssd1306.h"

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_gfx(keycode,record) && process_record_user(keycode, record);
}

void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
//led_set_user(usb_led);
Expand Down
17 changes: 15 additions & 2 deletions keyboards/helix/ssd1306.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#ifdef SSD1306OLED

#include "ssd1306.h"
Expand Down Expand Up @@ -27,12 +28,17 @@
//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) {
Expand Down Expand Up @@ -318,12 +324,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
3 changes: 2 additions & 1 deletion keyboards/helix/ssd1306.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <stdbool.h>
#include <stdio.h>
#include "pincontrol.h"
#include "action.h"

enum ssd1306_cmds {
DisplayOff = 0xAE,
Expand Down Expand Up @@ -87,6 +88,6 @@ void matrix_write(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);

#endif