Skip to content

Commit

Permalink
chore:rename oled_enable to oled_always_enable
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasVon2021 committed Nov 3, 2024
1 parent 9b00441 commit bcc37a7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion script/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "v1.5.0",
"md5value": "",
"oled":{
"oled_enable": 1,
"oled_always_enable": 1,
"restart_show_time": 30,
"interval_display_time": 5
},
Expand Down
6 changes: 3 additions & 3 deletions src/config/blikvm_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ blikvm_config_t* blikvm_read_config(blikvm_int8_t* file_path)
const cJSON *oled = cJSON_GetObjectItemCaseSensitive(root, "oled");
if (cJSON_IsObject(oled))
{
const cJSON *oled_enable = cJSON_GetObjectItemCaseSensitive(oled, "oled_enable");
const cJSON *oled_enable = cJSON_GetObjectItemCaseSensitive(oled, "oled_always_enable");
const cJSON *restart_show_time = cJSON_GetObjectItemCaseSensitive(oled, "restart_show_time");
const cJSON *interval_display_time = cJSON_GetObjectItemCaseSensitive(oled, "interval_display_time");

if (cJSON_IsNumber(oled_enable))
{
BLILOG_I(TAG, "oled_enable: %d\n", oled_enable->valueint);
g_config.oled.oled_enable = oled_enable->valueint;
BLILOG_I(TAG, "oled_always_enable: %d\n", oled_enable->valueint);
g_config.oled.oled_always_enable = oled_enable->valueint;
}

if (cJSON_IsNumber(restart_show_time))
Expand Down
10 changes: 5 additions & 5 deletions src/kvmd/blikvm_oled/blikvm_oled.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ blikvm_int8_t blikvm_oled_init(blikvm_oled_config_t* config)
#ifdef ST7789
case OLED_ST7789_240_240:
oled_240_240_init();
if(config->oled_enable == 0 ){
if(config->oled_always_enable == 0 ){
blikvm_backlight_close();
}

Expand Down Expand Up @@ -123,7 +123,7 @@ static blikvm_void_t *blikvm_oled_loop(void *_)
{

blikvm_oled_config_t* oled_config = &(blikvm_get_config()->oled) ;
if((oled_config->oled_enable == 0) && (oled_config->restart_show_time ==0) && (oled_config->interval_display_time == 0) )
if((oled_config->oled_always_enable == 0) && (oled_config->restart_show_time ==0) && (oled_config->interval_display_time == 0) )
{
return NULL;
}
Expand All @@ -132,7 +132,7 @@ static blikvm_void_t *blikvm_oled_loop(void *_)
{
blikvm_int32_t uptime = skdy_get_int_uptime() - uptime_start; //unit:min
blikvm_int32_t last_display_enable = oled_config->display_enable;
if( (oled_config->oled_enable == 0) && (uptime> oled_config->restart_show_time) && (oled_config->interval_display_time > 0))
if( (oled_config->oled_always_enable == 0) && (uptime> oled_config->restart_show_time) && (oled_config->interval_display_time > 0))
{
blikvm_int32_t sleep_counter = oled_config->interval_display_time * 60;
BLILOG_D(TAG,"oled sleep time:%ds\n", sleep_counter );
Expand All @@ -147,7 +147,7 @@ static blikvm_void_t *blikvm_oled_loop(void *_)

}
#ifdef VER4
if((oled_config->oled_enable == 1) && (oled_config->display_enable == 1))
if((oled_config->oled_always_enable == 1) && (oled_config->display_enable == 1))
{
sleep(1); //unit: s
continue;
Expand All @@ -166,7 +166,7 @@ static blikvm_void_t *blikvm_oled_loop(void *_)
#ifdef ST7789
case OLED_ST7789_240_240:
blikvm_int32_t oled_show_counter = 1;
if(oled_config->display_enable == 1 ){
if(oled_config->oled_always_enable == 0 ){
oled_show_counter = 6;
}
for( int j=0; j<oled_show_counter; j++)
Expand Down
2 changes: 1 addition & 1 deletion src/kvmd/blikvm_oled/blikvm_oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ typedef enum
typedef struct
{
blikvm_int8_t oled_type;
blikvm_int32_t oled_enable;
blikvm_int32_t oled_always_enable;
blikvm_int32_t display_enable;
blikvm_int32_t restart_show_time; // unit: min
blikvm_int32_t interval_display_time; //unit: min
Expand Down

0 comments on commit bcc37a7

Please sign in to comment.