Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
akasaka committed Nov 19, 2024
2 parents af2012e + c10b198 commit 307f9f8
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 21 deletions.
1 change: 1 addition & 0 deletions include/devices/mid_clock_noritake.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

// #define HAS_OTAFVU
#define HAS_OUTPUT_GU7000
#define HAS_DISPLAY_BLANKING
#define HAS_MOTION_SENSOR
#define HAS_TEMP_SENSOR
#define HAS_KEYPAD
Expand Down
1 change: 1 addition & 0 deletions include/devices/mid_clock_noritake_wide.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#define HAS_OTAFVU
#define HAS_OUTPUT_GU7000
#define HAS_DISPLAY_BLANKING
// #define HAS_TEMP_SENSOR
#define HAS_MOTION_SENSOR
#define HAS_KEYPAD
Expand Down
1 change: 1 addition & 0 deletions include/display/gu7000.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ItronGU7000Driver: public DisplayDriver {
gpio_num_t databus_gpios[8];
gpio_num_t wr_gpio;
gpio_num_t busy_gpio;
bool show_state;

inline void set_databus(uint8_t data);
inline void pulse_clock();
Expand Down
6 changes: 3 additions & 3 deletions src/app/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,6 @@ AppShimMenu::AppShimMenu(Beeper *b, NewSequencer *s, Yukkuri *y, AmbientLightSen
screen_times->add_view(new MenuNumberSelectorPreferenceView(localized_string("Wordnik"), PREFS_KEY_SCRN_TIME_WORD_OF_THE_DAY_SECONDS, 0, 3600, 1, normalActivationFunction));
#endif
screen_times->add_view(new MenuNumberSelectorPreferenceView(localized_string("Foobar2000"), PREFS_KEY_SCRN_TIME_FOOBAR_SECONDS, 0, 3600, 1, normalActivationFunction));
#if HAS(DISPLAY_BLANKING)
display_menu->add_view(new MenuNumberSelectorPreferenceView(localized_string("Blank display after (s)"), PREFS_KEY_MOTIONLESS_TIME_OFF_SECONDS, 0, 21600, 1, normalActivationFunction));
#endif
#if HAS(VARYING_BRIGHTNESS)
display_menu->add_view(new MenuListSelectorPreferenceView(
localized_string("Brightness"),
Expand All @@ -245,6 +242,9 @@ AppShimMenu::AppShimMenu(Beeper *b, NewSequencer *s, Yukkuri *y, AmbientLightSen
PREFS_KEY_BRIGHTNESS_MODE,
normalActivationFunction
));
#endif
#if HAS(DISPLAY_BLANKING)
display_menu->add_view(new MenuNumberSelectorPreferenceView(localized_string("Blank display after (s)"), PREFS_KEY_MOTIONLESS_TIME_OFF_SECONDS, 0, 21600, 1, normalActivationFunction));
#endif
display_menu->add_view(new MenuNumberSelectorPreferenceView(localized_string("Turn display off after (s)"), PREFS_KEY_MOTIONLESS_TIME_HV_OFF_SECONDS, 0, 72000, 1, normalActivationFunction));
display_menu->add_view(new MenuBooleanSettingView(localized_string("Keypress beep"), PREFS_KEY_BUTTON_BEEP, [b](bool newValue) {
Expand Down
64 changes: 46 additions & 18 deletions src/display/gu7000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ void ItronGU7000Driver::initialize() {

ESP_ERROR_CHECK(gpio_config(&io_conf));

show_state = true;

wait_shit_through();
delay(2000);
}
Expand Down Expand Up @@ -94,7 +96,6 @@ void ItronGU7000Driver::write_string(const char * s) {
}

void ItronGU7000Driver::reset() {
// taskENTER_CRITICAL(&_spinlock);
wait_shit_through();

// Bringup Step 1: Initialize display
Expand All @@ -119,12 +120,37 @@ void ItronGU7000Driver::reset() {
}

void ItronGU7000Driver::set_show(bool show) {
taskENTER_CRITICAL(&_spinlock);

ESP_LOGI(LOG_TAG, "Show = %i", show);
/**
* From datasheet:
*
* P=2~4の場合、スクリーンセーバーの起動を行ないます。スクリーンセーバーは
* 次のデータ入力により中断され、コマンド以前の表示状態に復帰します
*
* Thus we need to save the show state and stop data flow when entering screen blanking mode
*/
show_state = show;
write_string("\x1F\x28\x61\x40");
// Turn off the display without turning off the heaters. This helps reduce strain on the heaters and prevent their failure from metal fatigue.
set_databus(show ? 0x1 : 0x2);
pulse_clock();

taskEXIT_CRITICAL(&_spinlock);
}

void ItronGU7000Driver::set_power(bool power) {
taskENTER_CRITICAL(&_spinlock);

/**
* From datasheet:
* P=0~1の場合、表示用電源のON/OFF制御を行ないます。
* 次の表示用電源のON/OFF制御コマンドが入力されるまで保持されます
*
* Thus we don't need to save state unlike the `set_show` command
*/
ESP_LOGI(LOG_TAG, "Power = %i", power);
write_string("\x1F\x28\x61\x40");
set_databus(power ? 0x1 : 0x0);
pulse_clock();
Expand Down Expand Up @@ -152,25 +178,27 @@ inline uint8_t flipByte(uint8_t c){
void ItronGU7000Driver::write_fanta(const uint8_t * strides, size_t count) {
taskENTER_CRITICAL(&_spinlock);

write_string("\x1F\x24"); // cursor move to 0
set_databus(0);
pulse_clock(); pulse_clock(); pulse_clock(); pulse_clock();

write_string("\x1F\x28\x66\x11");
set_databus(HWCONF_DISPLAY_WIDTH_PX & 0x00FF);
pulse_clock();
set_databus(HWCONF_DISPLAY_WIDTH_PX & 0xFF00);
pulse_clock();
set_databus((HWCONF_DISPLAY_HEIGHT_PX / 8) & 0x00FF);
pulse_clock();
set_databus((HWCONF_DISPLAY_HEIGHT_PX / 8) & 0xFF00);
pulse_clock();
set_databus(1);
pulse_clock();
if(show_state) { // <- see technote in `set_show` method above
write_string("\x1F\x24"); // cursor move to 0
set_databus(0);
pulse_clock(); pulse_clock(); pulse_clock(); pulse_clock();

for(int i = 0; i < count; i++) {
set_databus(flipByte(strides[i]));
write_string("\x1F\x28\x66\x11");
set_databus(HWCONF_DISPLAY_WIDTH_PX & 0x00FF);
pulse_clock();
set_databus(HWCONF_DISPLAY_WIDTH_PX & 0xFF00);
pulse_clock();
set_databus((HWCONF_DISPLAY_HEIGHT_PX / 8) & 0x00FF);
pulse_clock();
set_databus((HWCONF_DISPLAY_HEIGHT_PX / 8) & 0xFF00);
pulse_clock();
set_databus(1);
pulse_clock();

for(int i = 0; i < count; i++) {
set_databus(flipByte(strides[i]));
pulse_clock();
}
}

taskEXIT_CRITICAL(&_spinlock);
Expand Down

0 comments on commit 307f9f8

Please sign in to comment.