diff --git a/nspanel_blueprint.yaml b/nspanel_blueprint.yaml index 3dc39b4..105b9c5 100644 --- a/nspanel_blueprint.yaml +++ b/nspanel_blueprint.yaml @@ -7236,6 +7236,10 @@ action: repeat.item.entity.split(".") | default([]) | count > 0 }} then: + #- service: homeassistant.update_entity + # data: + # entity_id: '{{ repeat.item.entity }}' + # continue_on_error: true - variables: item_domain: '{{ repeat.item.entity.split(".")[0] | default("unknown") }}' current_entity_state: '{{ states(repeat.item.entity) | default("unavailable") }}' @@ -7615,77 +7619,35 @@ action: sequence: &refresh_page_media_player - variables: media_player_entity: '{{ nspanel_event.entity if nspanel_event is defined and nspanel_event.entity is defined else trigger.entity_id }}' - - service: homeassistant.update_entity - data: - entity_id: '{{ nspanel_event.entity }}' - continue_on_error: true - - delay: - milliseconds: 500 - - variables: - media_player: - state: '{{ states(media_player_entity) }}' - is_volume_muted: '{{ state_attr(media_player_entity, "is_volume_muted") | default(false) }}' - friendly_name: '{{ state_attr(media_player_entity, "friendly_name") | default("Media player") }}' - volume_level: '{{ (state_attr(media_player_entity, "volume_level") | round(2, default=0) * 100) | int(0) }}' - media_title: '{{ state_attr(media_player_entity, "media_title") }}' - media_artist: '{{ state_attr(media_player_entity, "media_artist") }}' - media_album_name: '{{ state_attr(media_player_entity, "media_album_name") }}' - media_duration: '{{ state_attr(media_player_entity, "media_duration") | int(0) }}' - media_position: '{{ state_attr(media_player_entity, "media_position") | int(0) }}' - media_position_updated_at: '{{ state_attr(media_player_entity, "media_position_updated_at") }}' - supported_features: '{{ state_attr(media_player_entity, "supported_features") | int(0) }}' - feature: - PAUSE: 1 - SEEK: 2 - VOLUME_SET: 4 - VOLUME_MUTE: 8 - PREVIOUS_TRACK: 16 - NEXT_TRACK: 32 - reserved: 64 - TURN_ON: 128 - TURN_OFF: 256 - PLAY_MEDIA: 512 - VOLUME_STEP: 1024 - SELECT_SOURCE: 2048 - STOP: 4096 - CLEAR_PLAYLIST: 8192 - PLAY: 16384 - SHUFFLE_SET: 32768 - SELECT_SOUND_MODE: 65536 - BROWSE_MEDIA: 131072 - REPEAT_SET: 262144 - GROUPING: 524288 - MEDIA_ANNOUNCE: 1048576 - MEDIA_ENQUEUE: 2097152 - position_int: '{{ 0 if media_player.media_duration <= 0 else (100*(media_player.media_position)/(media_player.media_duration)) | round(0, default=0) }}' - position_str: '{{ "" if media_player.media_duration <= 0 else timedelta(seconds=position_int) }}' - duration_str: '{{ "" if media_player.media_duration <= 0 else timedelta(seconds=(media_player.media_duration)) }}' - - service: '{{ nextion.command.media_player }}' - data: - entity: '{{ media_player_entity }}' - state: '{{ media_player.state }}' - page_title: '{{ media_player.friendly_name }}' - track: '{{ media_player.media_title }}' - artist: '{{ media_player.media_artist }}' - bt_on_off: '{{ media_player.supported_features | bitwise_and(feature.TURN_ON) > 0 }}' - bt_prev: '{{ media_player.supported_features | bitwise_and(feature.PREVIOUS_TRACK) > 0 }}' - bt_play_pause: '{{ 2 if media_player.state == "playing" else (1 if media_player.state == "paused" else 0)}}' - bt_stop: '{{ media_player.supported_features | bitwise_and(feature.STOP) > 0 }}' - bt_next: '{{ media_player.supported_features | bitwise_and(feature.NEXT_TRACK) > 0 }}' - time_current: '{{ media_player.media_position }}' - time_total: '{{ media_player.media_duration }}' - time_progress: '{{ 0 if media_player.media_duration <= 0 else (100*media_player.media_position/media_player.media_duration) | round(0, default=0) }}' - volume: '{{ media_player.volume_level }}' - bt_mute: '{{ 1 if media_player.is_volume_muted else 2 }}' - bt_vol_down: '{{ media_player.supported_features | bitwise_and(feature.VOLUME_SET) > 0 }}' - bt_vol_up: '{{ media_player.supported_features | bitwise_and(feature.VOLUME_SET) > 0 }}' - continue_on_error: true - - delay: - milliseconds: 500 - - service: homeassistant.update_entity - data: - entity_id: '{{ nspanel_event.entity }}' - continue_on_error: true + - alias: Refresh page in a loop + repeat: + sequence: + - &update_entity + service: homeassistant.update_entity + data: + entity_id: '{{ nspanel_event.entity }}' + continue_on_error: true + - delay: + milliseconds: 500 + - service: '{{ nextion.command.media_player }}' + data: + entity: '{{ media_player_entity }}' + state: '{{ states(media_player_entity) }}' + is_volume_muted: '{{ state_attr(media_player_entity, "is_volume_muted") | default(false) }}' + friendly_name: '{{ state_attr(media_player_entity, "friendly_name") | default("Media player") }}' + volume_level: '{{ (state_attr(media_player_entity, "volume_level") | round(2, default=0) * 100) | int(0) }}' + media_title: '{{ state_attr(media_player_entity, "media_title") }}' + media_artist: '{{ state_attr(media_player_entity, "media_artist") }}' + media_duration: '{{ state_attr(media_player_entity, "media_duration") | int(0) }}' + media_position: '{{ state_attr(media_player_entity, "media_position") | int(0) }}' + #media_position_updated_at: '{{ state_attr(media_player_entity, "media_position_updated_at") }}' + supported_features: '{{ state_attr(media_player_entity, "supported_features") | int(0) }}' + continue_on_error: true + - delay: 10 + until: + - not: + - '{{ states(currentpage) == page.media_player }}' # Do not change this to `page.current` as this have to be reloaded every time + - '{{ nspanel_event.type == "page_changed"}}' ## PAGE ALARM ## - alias: Alarm settings page diff --git a/nspanel_esphome.yaml b/nspanel_esphome.yaml index 1c2b602..d90e319 100644 --- a/nspanel_esphome.yaml +++ b/nspanel_esphome.yaml @@ -457,7 +457,7 @@ api: id(home_time_color) = time_color; // Embedded thermostat - id(addon_climate_global_settings)->execute(embedded_climate); + id(is_embedded_thermostat) = embedded_climate; // Indoor temperature id(embedded_indoor_temp) = embedded_indoor_temperature; @@ -707,61 +707,139 @@ api: variables: entity: string state: string - page_title: string - track: string - artist: string - bt_on_off: int - bt_prev: bool - bt_play_pause: int - bt_stop: bool - bt_next: bool - time_current: int - time_total: int - time_progress: int - volume: int - bt_mute: int - bt_vol_down: bool - bt_vol_up: bool + is_volume_muted: bool + friendly_name: string + volume_level: int + media_title: string + media_artist: string + media_duration: int + media_position: int + supported_features: int then: - lambda: |- ESP_LOGV("service.media_player", "Starting"); if (id(current_page).state == "media_player") { id(disp1).set_component_text_printf("entity", "%s", entity.c_str()); - id(disp1).set_component_text_printf("page_title", "%s", page_title.c_str()); - id(display_wrapped_text).execute("track", track.c_str(), id(display_mode) == 2 ? 15 : 23); - id(display_wrapped_text).execute("artist", artist.c_str(), id(display_mode) == 2 ? 26 : 40); - if (bt_on_off > 0) + id(disp1).set_component_text_printf("page_label", "%s", friendly_name.c_str()); + id(display_wrapped_text).execute("track", media_title.c_str(), id(display_mode) == 2 ? 15 : 27); + id(display_wrapped_text).execute("artist", media_artist.c_str(), id(display_mode) == 2 ? 26 : 40); + // states: + // OFF: Entity is turned off and is not accepting commands until turned on. + // ON: Entity is turned on, but no details on its state is currently known. + // IDLE: Entity is turned on and accepting commands, but currently not playing any media. Possibly at some idle home screen. + // PLAYING: Entity is currently playing media. + // PAUSED: Entity has an active media and is currently paused + // STANDBY: Entity is in a low power state, accepting commands. + // BUFFERING: Entity is preparing to start playback of some media + // feature: + // PAUSE: 1 + // SEEK: 2 + // VOLUME_SET: 4 + // VOLUME_MUTE: 8 + // PREVIOUS_TRACK: 16 + // NEXT_TRACK: 32 + // reserved: 64 + // TURN_ON: 128 + // TURN_OFF: 256 + // PLAY_MEDIA: 512 + // VOLUME_STEP: 1024 + // SELECT_SOURCE: 2048 + // STOP: 4096 + // CLEAR_PLAYLIST: 8192 + // PLAY: 16384 + // SHUFFLE_SET: 32768 + // SELECT_SOUND_MODE: 65536 + // BROWSE_MEDIA: 131072 + // REPEAT_SET: 262144 + // GROUPING: 524288 + // MEDIA_ANNOUNCE: 1048576 + // MEDIA_ENQUEUE: 2097152 + + // on/off button + if (supported_features & 128 and state == "off") //TURN_ON { + id(set_component_color).execute("bt_on_off", { 65535 }, {} ); + id(disp1).show_component("bt_on_off"); + } + else if (supported_features & 256 and state != "off") //TURN_OFF + { + id(set_component_color).execute("bt_on_off", { 10597 }, {} ); id(disp1).show_component("bt_on_off"); - if (bt_on_off == 1) id(set_component_color).execute("bt_on_off", {255, 0, 0}, {} ); - else id(set_component_color).execute("bt_on_off", {0, 255, 0}, {} ); } else id(disp1).hide_component("bt_on_off"); - if (bt_prev) id(disp1).show_component("bt_prev"); else id(disp1).hide_component("bt_prev"); - if (bt_play_pause > 0) + + // play/pause button + if ((supported_features & 512 or supported_features & 16384) and state != "playing" and state != "off") //PLAY_MEDIA+PLAY { + id(disp1).set_component_text_printf("bt_play_pause", "%s", "\uE409"); // mdi:play + id(disp1).show_component("bt_play_pause"); + } + else if (supported_features & 1 and state == "playing" ) //PAUSE + { + id(disp1).set_component_text_printf("bt_play_pause", "%s", "\uE3E3"); // mdi:pause id(disp1).show_component("bt_play_pause"); - if (bt_play_pause == 1) id(disp1).set_component_text_printf("bt_play_pause", "%s", "\uE409"); // mdi:play - else id(disp1).set_component_text_printf("bt_play_pause", "%s", "\uE3E3"); // mdi:pause } else id(disp1).hide_component("bt_play_pause"); - if (bt_stop) id(disp1).show_component("bt_stop"); else id(disp1).hide_component("bt_stop"); - if (bt_next) id(disp1).show_component("bt_next"); else id(disp1).hide_component("bt_next"); - id(disp1).set_component_text_printf("time_current", "%i", time_current); - id(disp1).set_component_text_printf("time_total", "%i", time_total); - id(disp1).set_component_value("time_progress", time_progress); - id(disp1).set_component_text_printf("vol_text", "%i%", volume); - id(disp1).set_component_value("vol_slider", volume); - if (bt_mute > 0) + + // bt_prev button - PREVIOUS_TRACK + if (supported_features & 16 and state != "off") id(disp1).show_component("bt_prev"); else id(disp1).hide_component("bt_prev"); + // bt_next button - NEXT_TRACK + if (supported_features & 32 and state != "off") id(disp1).show_component("bt_next"); else id(disp1).hide_component("bt_next"); + + // Stop button - STOP + if (supported_features & 4096 and (state == "playing" or state == "paused")) id(disp1).show_component("bt_stop"); else id(disp1).hide_component("bt_stop"); + + // mute/unmute button - VOLUME_MUTE + id(disp1).set_component_value("is_muted", (is_volume_muted) ? 1 : 0); + if (supported_features & 8 and is_volume_muted) // unmute { + id(disp1).set_component_text_printf("bt_mute", "%s", "\uE57E"); // mdi:volume-low + id(disp1).show_component("bt_mute"); + } + else if (supported_features & 8) // mute + { + id(disp1).set_component_text_printf("bt_mute", "%s", "\uEE07"); // mdi:volume-variant-off id(disp1).show_component("bt_mute"); - if (bt_mute == 1) id(disp1).set_component_text_printf("bt_mute", "%s", "\uE57E"); // mdi:volume-low - else id(disp1).set_component_text_printf("bt_mute", "%s", "\uEE07"); // mdi:volume-variant-off } else id(disp1).hide_component("bt_mute"); - if (bt_vol_down) id(disp1).show_component("bt_vol_down"); else id(disp1).hide_component("bt_vol_down"); - if (bt_vol_up) id(disp1).show_component("bt_vol_up"); else id(disp1).hide_component("bt_vol_up"); + + // VOLUME_SET + if (supported_features & 4) + { + id(disp1).set_component_text_printf("vol_text", "%i%%", volume_level); + id(disp1).set_component_value("vol_slider", volume_level); + id(disp1).show_component("vol_slider"); + id(disp1).show_component("bt_vol_down"); + id(disp1).show_component("bt_vol_up"); + id(disp1).show_component("vol_text"); + } + else + { + id(disp1).hide_component("vol_slider"); + id(disp1).hide_component("bt_vol_down"); + id(disp1).hide_component("bt_vol_up"); + id(disp1).hide_component("vol_text"); + } + + if (media_duration > 0) + { + id(disp1).set_component_text_printf("time_current", "%i", media_position); + id(disp1).set_component_text_printf("time_total", "%i", media_duration); + id(disp1).set_component_value("prg_current", media_position); + id(disp1).set_component_value("prg_total", media_duration); + id(disp1).send_command_printf("prg_timer.en=%i", (state == "playing") ? 1 : 0); + id(disp1).show_component("time_current"); + id(disp1).show_component("time_total"); + id(disp1).show_component("time_progress"); + } + else + { + id(disp1).send_command_printf("prg_timer.en=0"); + id(disp1).hide_component("time_current"); + id(disp1).hide_component("time_total"); + id(disp1).hide_component("time_progress"); + } } ##### START - GLOBALS CONFIGURATION ##### @@ -773,6 +851,18 @@ globals: restore_value: true initial_value: '0' + ##### Entity Id of the entity displayed on the detailed pages + - id: entity_id + type: std::string + restore_value: no + initial_value: '' + + ##### Is embedded thermostat set as main climate entity? ##### + - id: is_embedded_thermostat + type: bool + restore_value: true + initial_value: 'false' + ##### Save Display Brightness for NSPanel reboot ##### - id: display_brightness_global type: int @@ -1303,7 +1393,7 @@ text_sensor: {"entity", entity} }); ESP_LOGV("text_sensor.localevent", "Call add-ons scripts for new page"); - id(addon_climate_set_climate).execute(page=="climate" and entity=="embedded_climate"); + id(addon_climate_set_climate).execute(page=="climate" and id(entity_id) == "embedded_climate"); ESP_LOGV("text_sensor.localevent", "Publish current_page sensor"); id(current_page).publish_state(page); ESP_LOGV("text_sensor.localevent", "Construct new page"); @@ -2197,7 +2287,7 @@ script: - id: check_versions mode: restart then: - - delay: 30s + - delay: 60s - lambda: |- ESP_LOGD("script.check_versions", "ESPHome version: ${version}"); ESP_LOGD("script.check_versions", "TFT version: %s", id(version_tft).c_str()); @@ -2239,15 +2329,6 @@ script: - lambda: |- ESP_LOGV("script.addon_climate_set_climate", "Check for addon_climate"); ESP_LOGV("script.addon_climate_set_climate", "embedded_climate: %i", (embedded_climate) ? 1 : 0); - - id: addon_climate_global_settings - mode: restart - parameters: - embedded_climate: bool - then: - # Reserved for Add-on Climate - - lambda: |- - ESP_LOGV("script.addon_climate_global_settings", "Check for addon_climate"); - ESP_LOGV("script.addon_climate_global_settings", "embedded_climate: %i", (embedded_climate) ? 1 : 0); - id: addon_climate_update_page_climate mode: restart then: diff --git a/nspanel_esphome_addon_climate_cool.yaml b/nspanel_esphome_addon_climate_cool.yaml index 5f627a1..7c0b096 100644 --- a/nspanel_esphome_addon_climate_cool.yaml +++ b/nspanel_esphome_addon_climate_cool.yaml @@ -55,11 +55,6 @@ climate: ###### All the code bellow this point is shared between addon_climate_cool and addon_climate_heat ##### globals: - ##### Is embedded thermostat set as main climate entity? ##### - - id: is_embedded_thermostat - type: bool - restore_value: true - initial_value: 'false' ##### Is embedded thermostat visible on climate page? ##### - id: is_addon_climate_visible type: bool @@ -113,14 +108,6 @@ script: id(is_addon_climate_visible) = embedded_climate; ESP_LOGV("script.addon_climate_set_climate", "Finished"); - - id: !extend addon_climate_global_settings - then: - - lambda: |- - ESP_LOGV("script.addon_climate_global_settings", "Starting"); - ESP_LOGV("script.addon_climate_global_settings", "embedded_climate: %i", (embedded_climate) ? 1 : 0); - id(is_embedded_thermostat) = embedded_climate; - ESP_LOGV("script.addon_climate_global_settings", "Finished"); - - id: !extend addon_climate_update_page_climate then: - lambda: |- diff --git a/nspanel_esphome_addon_climate_heat.yaml b/nspanel_esphome_addon_climate_heat.yaml index 9a6fc2c..52a2740 100644 --- a/nspanel_esphome_addon_climate_heat.yaml +++ b/nspanel_esphome_addon_climate_heat.yaml @@ -55,11 +55,6 @@ climate: ###### All the code bellow this point is shared between addon_climate_cool and addon_climate_heat ##### globals: - ##### Is embedded thermostat set as main climate entity? ##### - - id: is_embedded_thermostat - type: bool - restore_value: true - initial_value: 'false' ##### Is embedded thermostat visible on climate page? ##### - id: is_addon_climate_visible type: bool @@ -113,14 +108,6 @@ script: id(is_addon_climate_visible) = embedded_climate; ESP_LOGV("script.addon_climate_set_climate", "Finished"); - - id: !extend addon_climate_global_settings - then: - - lambda: |- - ESP_LOGV("script.addon_climate_global_settings", "Starting"); - ESP_LOGV("script.addon_climate_global_settings", "embedded_climate: %i", (embedded_climate) ? 1 : 0); - id(is_embedded_thermostat) = embedded_climate; - ESP_LOGV("script.addon_climate_global_settings", "Finished"); - - id: !extend addon_climate_update_page_climate then: - lambda: |- diff --git a/nspanel_eu.HMI b/nspanel_eu.HMI index 5db184d..e7856d0 100644 Binary files a/nspanel_eu.HMI and b/nspanel_eu.HMI differ diff --git a/nspanel_eu.tft b/nspanel_eu.tft index b64f172..061a4af 100644 Binary files a/nspanel_eu.tft and b/nspanel_eu.tft differ diff --git a/nspanel_eu_code/media_player.txt b/nspanel_eu_code/media_player.txt index 70a3b7e..77ec8e9 100644 --- a/nspanel_eu_code/media_player.txt +++ b/nspanel_eu_code/media_player.txt @@ -74,6 +74,18 @@ Variable (int32) is_muted Scope: local Value: 0 +Variable (int32) prg_current + Attributes + ID : 27 + Scope: local + Value: 0 + +Variable (int32) prg_total + Attributes + ID : 28 + Scope: local + Value: 0 + Text page_label Attributes ID : 1 @@ -102,7 +114,7 @@ Text vol_text Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 5 Text bt_vol_down Attributes @@ -424,3 +436,65 @@ Timer timer0 printh 00 printh FF FF FF +Timer prg_timer + Attributes + ID : 26 + Scope : local + Period (ms): 1000 + Enabled : no + + Events + Timer Event + if(prg_current.val0) + { + prg_current.val++ + time_progress.val=100*prg_current.val/prg_total.val + covx prg_current.val,time_current.txt,0,0 + } + // Progress - Total + sys0=prg_total.val/3600 //hours + sys2=prg_total.val%3600 //remainder + sys1=sys2/60 //minutes + sys2%=60 //seconds + time_total.txt="" + if(sys0>0) + { + covx sys0,time_total.txt,0,0 + time_total.txt+=":" + if(sys1<10) + { + time_total.txt+="0" + } + } + covx sys1,va0.txt,0,0 + time_total.txt+=va0.txt+":" + if(sys2<10) + { + time_total.txt+="0" + } + covx sys2,va0.txt,0,0 + time_total.txt+=va0.txt + // Progress - Current + sys0=prg_current.val/3600 //hours + sys2=prg_current.val%3600 //remainder + sys1=sys2/60 //minutes + sys2%=60 //seconds + time_current.txt="" + if(sys0>0) + { + covx sys0,time_current.txt,0,0 + time_current.txt+=":" + if(sys1<10) + { + time_current.txt+="0" + } + } + covx sys1,va0.txt,0,0 + time_current.txt+=va0.txt+":" + if(sys2<10) + { + time_current.txt+="0" + } + covx sys2,va0.txt,0,0 + time_current.txt+=va0.txt + diff --git a/nspanel_us.HMI b/nspanel_us.HMI index 55bb4c2..8032f85 100644 Binary files a/nspanel_us.HMI and b/nspanel_us.HMI differ diff --git a/nspanel_us.tft b/nspanel_us.tft index 39d31b8..938312a 100644 Binary files a/nspanel_us.tft and b/nspanel_us.tft differ diff --git a/nspanel_us_code/media_player.txt b/nspanel_us_code/media_player.txt index 70a3b7e..77ec8e9 100644 --- a/nspanel_us_code/media_player.txt +++ b/nspanel_us_code/media_player.txt @@ -74,6 +74,18 @@ Variable (int32) is_muted Scope: local Value: 0 +Variable (int32) prg_current + Attributes + ID : 27 + Scope: local + Value: 0 + +Variable (int32) prg_total + Attributes + ID : 28 + Scope: local + Value: 0 + Text page_label Attributes ID : 1 @@ -102,7 +114,7 @@ Text vol_text Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 5 Text bt_vol_down Attributes @@ -424,3 +436,65 @@ Timer timer0 printh 00 printh FF FF FF +Timer prg_timer + Attributes + ID : 26 + Scope : local + Period (ms): 1000 + Enabled : no + + Events + Timer Event + if(prg_current.val0) + { + prg_current.val++ + time_progress.val=100*prg_current.val/prg_total.val + covx prg_current.val,time_current.txt,0,0 + } + // Progress - Total + sys0=prg_total.val/3600 //hours + sys2=prg_total.val%3600 //remainder + sys1=sys2/60 //minutes + sys2%=60 //seconds + time_total.txt="" + if(sys0>0) + { + covx sys0,time_total.txt,0,0 + time_total.txt+=":" + if(sys1<10) + { + time_total.txt+="0" + } + } + covx sys1,va0.txt,0,0 + time_total.txt+=va0.txt+":" + if(sys2<10) + { + time_total.txt+="0" + } + covx sys2,va0.txt,0,0 + time_total.txt+=va0.txt + // Progress - Current + sys0=prg_current.val/3600 //hours + sys2=prg_current.val%3600 //remainder + sys1=sys2/60 //minutes + sys2%=60 //seconds + time_current.txt="" + if(sys0>0) + { + covx sys0,time_current.txt,0,0 + time_current.txt+=":" + if(sys1<10) + { + time_current.txt+="0" + } + } + covx sys1,va0.txt,0,0 + time_current.txt+=va0.txt+":" + if(sys2<10) + { + time_current.txt+="0" + } + covx sys2,va0.txt,0,0 + time_current.txt+=va0.txt + diff --git a/nspanel_us_land.HMI b/nspanel_us_land.HMI index 328de8f..cd07af2 100644 Binary files a/nspanel_us_land.HMI and b/nspanel_us_land.HMI differ diff --git a/nspanel_us_land.tft b/nspanel_us_land.tft index 920fd6a..54f4cbf 100644 Binary files a/nspanel_us_land.tft and b/nspanel_us_land.tft differ diff --git a/nspanel_us_land_code/media_player.txt b/nspanel_us_land_code/media_player.txt index afbddc0..77ec8e9 100644 --- a/nspanel_us_land_code/media_player.txt +++ b/nspanel_us_land_code/media_player.txt @@ -74,6 +74,18 @@ Variable (int32) is_muted Scope: local Value: 0 +Variable (int32) prg_current + Attributes + ID : 27 + Scope: local + Value: 0 + +Variable (int32) prg_total + Attributes + ID : 28 + Scope: local + Value: 0 + Text page_label Attributes ID : 1 @@ -102,7 +114,7 @@ Text vol_text Send Component ID : disabled Associated Keyboard: none Text : - Max. Text Size : 10 + Max. Text Size : 5 Text bt_vol_down Attributes @@ -118,7 +130,7 @@ Text bt_vol_down Touch Release Event if(vol_slider.val>0) { - vol_slider.val++ + vol_slider.val-- covx vol_slider.val,va0.txt,0,0 vol_text.txt=va0.txt+"%" timer0.en=1 @@ -144,7 +156,7 @@ Text bt_vol_up Touch Release Event if(vol_slider.val<100) { - vol_slider.val-- + vol_slider.val++ covx vol_slider.val,va0.txt,0,0 vol_text.txt=va0.txt+"%" timer0.en=1 @@ -424,3 +436,65 @@ Timer timer0 printh 00 printh FF FF FF +Timer prg_timer + Attributes + ID : 26 + Scope : local + Period (ms): 1000 + Enabled : no + + Events + Timer Event + if(prg_current.val0) + { + prg_current.val++ + time_progress.val=100*prg_current.val/prg_total.val + covx prg_current.val,time_current.txt,0,0 + } + // Progress - Total + sys0=prg_total.val/3600 //hours + sys2=prg_total.val%3600 //remainder + sys1=sys2/60 //minutes + sys2%=60 //seconds + time_total.txt="" + if(sys0>0) + { + covx sys0,time_total.txt,0,0 + time_total.txt+=":" + if(sys1<10) + { + time_total.txt+="0" + } + } + covx sys1,va0.txt,0,0 + time_total.txt+=va0.txt+":" + if(sys2<10) + { + time_total.txt+="0" + } + covx sys2,va0.txt,0,0 + time_total.txt+=va0.txt + // Progress - Current + sys0=prg_current.val/3600 //hours + sys2=prg_current.val%3600 //remainder + sys1=sys2/60 //minutes + sys2%=60 //seconds + time_current.txt="" + if(sys0>0) + { + covx sys0,time_current.txt,0,0 + time_current.txt+=":" + if(sys1<10) + { + time_current.txt+="0" + } + } + covx sys1,va0.txt,0,0 + time_current.txt+=va0.txt+":" + if(sys2<10) + { + time_current.txt+="0" + } + covx sys2,va0.txt,0,0 + time_current.txt+=va0.txt +