some updates and fixes

This commit is contained in:
sharandac
2020-08-24 11:05:18 +02:00
parent d9d80b84c3
commit b550074ec4
23 changed files with 7661 additions and 12280 deletions

View File

@@ -209,7 +209,7 @@ void crypto_ticker_main_sync_Task( void * pvParameters ) {
crypto_ticker_config_t *crypto_ticker_config = crypto_ticker_get_config();
int32_t retval = -1;
log_i("start crypto ticker main task");
log_i("start crypto ticker main task, heap: %d", ESP.getFreeHeap() );
vTaskDelay( 250 );
@@ -241,5 +241,6 @@ void crypto_ticker_main_sync_Task( void * pvParameters ) {
}
}
xEventGroupClearBits( crypto_ticker_main_event_handle, CRYPTO_TICKER_MAIN_SYNC_REQUEST );
log_i("finish crypto ticker main task, heap: %d", ESP.getFreeHeap() );
vTaskDelete( NULL );
}

View File

@@ -56,7 +56,7 @@ void osmand_app_setup( void ) {
osmand_app_main_tile_num = mainbar_add_app_tile( 1, 1 );
// create an app icon, label it and get the lv_obj_t icon container
osmand_app_icon_cont = app_tile_register_app( "osmand");
osmand_app_icon_cont = app_tile_register_app( "OsmAnd");
// set your own icon and register her callback to activate by an click
// remember, an app icon must have an size of 64x64 pixel with an alpha channel
// use https://lvgl.io/tools/imageconverter to convert your images and set "true color with alpha" to get fancy images
@@ -94,9 +94,6 @@ static void enter_osmand_app_event_cb( lv_obj_t * obj, lv_event_t event ) {
switch( event ) {
case( LV_EVENT_CLICKED ): statusbar_hide( true );
osmand_app_hide_app_icon_info( true );
#ifdef EXAMPLE_WIDGET
example_app_hide_widget_icon_info( true );
#endif
mainbar_jump_to_tilenumber( osmand_app_main_tile_num, LV_ANIM_OFF );
break;
}

View File

@@ -62,22 +62,30 @@ LV_FONT_DECLARE(Ubuntu_32px);
struct direction_t direction[] PROGMEM = {
// english directions
{ "ahead", &ahead_128px },
{ "slightly left", &slightly_left_128px },
{ "slightly right", &slightly_right_128px },
{ "sharply left", &sharply_left_128px },
{ "sharply right", &sharply_right_128px },
{ "turn left", &turn_left_128px },
{ "turn right", &turn_right_128px },
{ "ahead", "", &ahead_128px },
{ "left", "slightly", &slightly_left_128px },
{ "right", "slightly", &slightly_right_128px },
{ "left", "sharply", &sharply_left_128px },
{ "right", "sharply", &sharply_right_128px },
{ "turn left", "", &turn_left_128px },
{ "turn right", "", &turn_right_128px },
// german direction
{ "Geradeaus", &ahead_128px },
{ "halb links abbiegen", &slightly_left_128px },
{ "halb rechts abbiegen", &slightly_right_128px },
{ "scharf links abbiegen", &sharply_left_128px },
{ "scharf rechts abbiegen", &sharply_right_128px },
{ "links abbiegen", &turn_left_128px },
{ "rechts abbiegen", &turn_right_128px },
{ "", NULL }
{ "Geradeaus", "", &ahead_128px },
{ "links abbiegen", "halb", &slightly_left_128px },
{ "rechts abbiegen", "halb", &slightly_right_128px },
{ "links abbiegen", "scharf", &sharply_left_128px },
{ "rechts abbiegen", "scharf", &sharply_right_128px },
{ "links abbiegen", "", &turn_left_128px },
{ "rechts abbiegen", "", &turn_right_128px },
// french direction
{ "Avancez", "", &ahead_128px },
{ "gauche et continuez", "vers la", &slightly_left_128px },
{ "droite et continuez", "vers la", &slightly_right_128px },
{ "gauche et continuez", "franchement", &sharply_left_128px },
{ "droite et continuez", "franchement", &sharply_right_128px },
{ "gauche et continuez", "", &turn_left_128px },
{ "droite et continuez", "", &turn_right_128px },
{ "", "", NULL }
};
static void exit_osmand_app_main_event_cb( lv_obj_t * obj, lv_event_t event );
@@ -186,7 +194,7 @@ void osmand_bluetooth_message_msg_pharse( char* msg ) {
const lv_img_dsc_t *osmand_find_direction_img( const char * msg ) {
for ( int i = 0; direction[ i ].img != NULL; i++ ) {
if ( strstr( msg, direction[ i ].direction ) ) {
if ( strstr( msg, direction[ i ].direction ) && strstr( msg, direction[ i ].direction_helper ) ) {
log_i("hit: %s -> %s", msg, direction[ i ].direction );
return( direction[ i ].img );
}
@@ -200,7 +208,7 @@ void osmand_activate_cb( void ) {
osmand_block_return_maintile = display_get_block_return_maintile();
display_set_block_return_maintile( true );
_osmand_app_task = lv_task_create(osmand_app_task, 1000, LV_TASK_PRIO_LOWEST, NULL );
lv_label_set_text( osmand_app_info_label, "wait for osmand msg");
lv_label_set_text( osmand_app_info_label, "wait for OsmAnd msg");
lv_obj_align( osmand_app_info_label, osmand_app_distance_label, LV_ALIGN_OUT_BOTTOM_MID, 0, 5 );
}

View File

@@ -25,7 +25,8 @@
#include <TTGO.h>
struct direction_t {
char direction[ 64 ];
char direction[ 48 ];
char direction_helper[ 48 ];
const lv_img_dsc_t *img;
};

View File

@@ -177,7 +177,7 @@ weather_config_t *weather_get_config( void ) {
}
void weather_widget_sync_Task( void * pvParameters ) {
log_i("start weather widget task");
log_i("start weather widget task, heap: %d", ESP.getFreeHeap() );
vTaskDelay( 250 );
@@ -211,6 +211,7 @@ void weather_widget_sync_Task( void * pvParameters ) {
lv_obj_invalidate( lv_scr_act() );
}
xEventGroupClearBits( weather_widget_event_handle, WEATHER_WIDGET_SYNC_REQUEST );
log_i("finish weather widget task, heap: %d", ESP.getFreeHeap() );
vTaskDelete( NULL );
}

View File

@@ -193,7 +193,7 @@ void weather_forecast_sync_Task( void * pvParameters ) {
weather_config_t *weather_config = weather_get_config();
int32_t retval = -1;
log_i("start weather forecast task");
log_i("start weather forecast task, heap: %d", ESP.getFreeHeap() );
vTaskDelay( 250 );
@@ -242,5 +242,6 @@ void weather_forecast_sync_Task( void * pvParameters ) {
}
}
xEventGroupClearBits( weather_forecast_event_handle, WEATHER_FORECAST_SYNC_REQUEST );
log_i("finsh weather forecast task, heap: %d", ESP.getFreeHeap() );
vTaskDelete( NULL );
}

View File

@@ -32,6 +32,6 @@
/*
* firmeware version string
*/
#define __FIRMWARE__ "2020082302"
#define __FIRMWARE__ "2020082401"
#endif // _CONFIG_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -25,52 +25,45 @@
#include "app_tile.h"
lv_app_icon_t app_entry[ MAX_APPS_ICON ];
static lv_obj_t *app_cont = NULL;
static lv_obj_t *app_label = NULL;
static uint32_t app_tile_num;
static lv_style_t *style;
static lv_style_t appstyle;
lv_obj_t *app_cont[ MAX_APPS_TILES ];
uint32_t app_tile_num[ MAX_APPS_TILES ];
static lv_style_t app_style;
LV_FONT_DECLARE(Ubuntu_72px);
LV_FONT_DECLARE(Ubuntu_16px);
void app_tile_setup( void ) {
app_tile_num = mainbar_add_tile( 1, 0 );
app_cont = mainbar_get_tile_obj( app_tile_num );
style = mainbar_get_style();
lv_style_copy( &appstyle, style);
lv_style_set_text_opa( &appstyle, LV_OBJ_PART_MAIN, LV_OPA_30);
lv_style_set_text_font( &appstyle, LV_STATE_DEFAULT, &Ubuntu_72px);
for ( int tiles = 0 ; tiles < MAX_APPS_TILES ; tiles++ ) {
app_tile_num[ tiles ] = mainbar_add_tile( 1 + tiles , 0 );
app_cont[ tiles ] = mainbar_get_tile_obj( app_tile_num[ tiles ] );
}
app_label = lv_label_create( app_cont, NULL);
lv_label_set_text( app_label, "apps");
lv_obj_reset_style_list( app_label, LV_OBJ_PART_MAIN );
lv_obj_add_style( app_label, LV_OBJ_PART_MAIN, &appstyle );
lv_obj_align( app_label, NULL, LV_ALIGN_CENTER, 0, 0);
lv_style_copy( &app_style, mainbar_get_style() );
for ( int app = 0 ; app < MAX_APPS_ICON ; app++ ) {
// set x, y and mark it as inactive
app_entry[ app ].x = APP_FIRST_X_POS + ( ( app % MAX_APPS_ICON_HORZ ) * ( APP_ICON_X_SIZE + APP_ICON_X_CLEARENCE ) );
app_entry[ app ].y = APP_FIRST_Y_POS + ( ( app / MAX_APPS_ICON_HORZ ) * ( APP_ICON_Y_SIZE + APP_ICON_Y_CLEARENCE ) );
app_entry[ app ].y = APP_FIRST_Y_POS + ( ( ( app % ( MAX_APPS_ICON_VERT * MAX_APPS_ICON_HORZ ) ) / MAX_APPS_ICON_HORZ ) * ( APP_ICON_Y_SIZE + APP_ICON_Y_CLEARENCE ) );
app_entry[ app ].active = false;
// create app icon container
app_entry[ app ].app = lv_obj_create( app_cont, NULL );
mainbar_add_slide_element(app_entry[ app ].app);
app_entry[ app ].app = lv_obj_create( app_cont[ app / ( MAX_APPS_ICON_HORZ * MAX_APPS_ICON_VERT ) ], NULL );
mainbar_add_slide_element( app_entry[ app ].app);
lv_obj_reset_style_list( app_entry[ app ].app, LV_OBJ_PART_MAIN );
lv_obj_add_style( app_entry[ app ].app, LV_OBJ_PART_MAIN, style );
lv_obj_add_style( app_entry[ app ].app, LV_OBJ_PART_MAIN, &app_style );
lv_obj_set_size( app_entry[ app ].app, APP_ICON_X_SIZE, APP_ICON_Y_SIZE );
lv_obj_align( app_entry[ app ].app , app_cont, LV_ALIGN_IN_TOP_LEFT, app_entry[ app ].x, app_entry[ app ].y );
lv_obj_align( app_entry[ app ].app , app_cont[ app / ( MAX_APPS_ICON_HORZ * MAX_APPS_ICON_VERT ) ], LV_ALIGN_IN_TOP_LEFT, app_entry[ app ].x, app_entry[ app ].y );
// create app label
app_entry[ app ].label = lv_label_create( app_cont, NULL );
app_entry[ app ].label = lv_label_create( app_cont[ app / ( MAX_APPS_ICON_HORZ * MAX_APPS_ICON_VERT ) ], NULL );
mainbar_add_slide_element(app_entry[ app ].label);
lv_obj_reset_style_list( app_entry[ app ].label, LV_OBJ_PART_MAIN );
lv_obj_add_style( app_entry[ app ].label, LV_OBJ_PART_MAIN, style );
lv_obj_add_style( app_entry[ app ].label, LV_OBJ_PART_MAIN, &app_style );
lv_obj_set_size( app_entry[ app ].label, APP_LABEL_X_SIZE, APP_LABEL_Y_SIZE );
lv_obj_align( app_entry[ app ].label , app_entry[ app ].app, LV_ALIGN_OUT_BOTTOM_MID, 0, 0 );
lv_obj_set_hidden( app_entry[ app ].app, true );
lv_obj_set_hidden( app_entry[ app ].label, true );
log_i("icon screen/x/y: %d/%d/%d", app / ( MAX_APPS_ICON_HORZ * MAX_APPS_ICON_VERT ), app_entry[ app ].x, app_entry[ app ].y );
}
}
@@ -90,5 +83,5 @@ lv_obj_t *app_tile_register_app( const char* appname ) {
}
uint32_t app_tile_get_tile_num( void ) {
return( app_tile_num );
return( app_tile_num[ 0 ] );
}

View File

@@ -26,7 +26,8 @@
#define MAX_APPS_ICON_HORZ 3
#define MAX_APPS_ICON_VERT 2
#define MAX_APPS_ICON ( MAX_APPS_ICON_HORZ * MAX_APPS_ICON_VERT )
#define MAX_APPS_TILES 2
#define MAX_APPS_ICON ( MAX_APPS_ICON_HORZ * MAX_APPS_ICON_VERT * MAX_APPS_TILES )
#define APP_ICON_X_SIZE 64
#define APP_ICON_Y_SIZE 64

View File

@@ -116,10 +116,15 @@ void bluetooth_call_msg_pharse( char* msg ) {
powermgm_set_event( POWERMGM_WAKEUP_REQUEST );
mainbar_jump_to_tilenumber( bluetooth_call_tile_num, LV_ANIM_OFF );
if ( doc["number"] ) {
lv_label_set_text( bluetooth_call_number_label, doc["number"] );
if ( doc["name"] ) {
lv_label_set_text( bluetooth_call_number_label, doc["name"] );
}
else {
lv_label_set_text( bluetooth_call_number_label, doc["number"] );
}
}
else {
lv_label_set_text( bluetooth_call_number_label, "" );
lv_label_set_text( bluetooth_call_number_label, "n/a" );
}
lv_obj_align( bluetooth_call_number_label, bluetooth_call_img, LV_ALIGN_OUT_BOTTOM_MID, 0, 5 );
lv_obj_invalidate( lv_scr_act() );

View File

@@ -136,7 +136,7 @@ void bluetooth_message_msg_pharse( char* msg ) {
if ( bluetooth_message_active == false ) {
return;
}
log_i("msg: %s", msg );
SpiRamJsonDocument doc( strlen( msg ) * 2 );
@@ -189,7 +189,9 @@ void bluetooth_message_msg_pharse( char* msg ) {
// set message
if ( doc["body"] )
lv_label_set_text( bluetooth_message_msg_label, doc["body"] );
else
else if ( doc["title"] )
lv_label_set_text( bluetooth_message_msg_label, doc["title"] );
else
lv_label_set_text( bluetooth_message_msg_label, "" );
// scroll back to the top

View File

@@ -32,7 +32,7 @@
#define SETUP_ICON_X_SIZE 64
#define SETUP_ICON_Y_SIZE 64
#define SETUP_ICON_X_CLEARENCE 8
#define SETUP_ICON_Y_CLEARENCE 16
#define SETUP_ICON_Y_CLEARENCE 36
#define SETUP_LABEL_X_SIZE SETUP_ICON_X_SIZE + SETUP_ICON_X_CLEARENCE
#define SETUP_LABEL_Y_SIZE SETUP_ICON_Y_CLEARENCE / 2

View File

@@ -206,7 +206,7 @@ void update_check_version( void ) {
}
void update_Task( void * pvParameters ) {
log_i("start update task");
log_i("start update task, heap: %d", ESP.getFreeHeap() );
if ( xEventGroupGetBits( update_event_handle) & UPDATE_GET_VERSION_REQUEST ) {
int64_t firmware_version = update_check_new_version( update_setup_get_url() );
@@ -269,5 +269,6 @@ void update_Task( void * pvParameters ) {
}
xEventGroupClearBits( update_event_handle, UPDATE_REQUEST | UPDATE_GET_VERSION_REQUEST );
lv_disp_trig_activity(NULL);
log_i("finish update task, heap: %d", ESP.getFreeHeap() );
vTaskDelete( NULL );
}

View File

@@ -249,61 +249,49 @@ void blectl_setup( void ) {
// Create the BLE Service
BLEService *pService = pServer->createService(SERVICE_UUID);
// Create a BLE Characteristic
pTxCharacteristic = pService->createCharacteristic( CHARACTERISTIC_UUID_TX, BLECharacteristic::PROPERTY_NOTIFY );
pTxCharacteristic->setAccessPermissions(ESP_GATT_PERM_READ_ENCRYPTED | ESP_GATT_PERM_WRITE_ENCRYPTED);
pTxCharacteristic->addDescriptor( new BLE2902() );
pRxCharacteristic = pService->createCharacteristic( CHARACTERISTIC_UUID_RX, BLECharacteristic::PROPERTY_WRITE );
pRxCharacteristic->setAccessPermissions(ESP_GATT_PERM_READ_ENCRYPTED | ESP_GATT_PERM_WRITE_ENCRYPTED);
pRxCharacteristic->setCallbacks( new BleCtlCallbacks() );
// Start the service
pService->start();
// Start advertising
pServer->getAdvertising()->addServiceUUID( pService->getUUID() );
// Create device information service
BLEService *pDeviceInformationService = pServer->createService(DEVICE_INFORMATION_SERVICE_UUID);
// Create manufacturer name string Characteristic -
BLECharacteristic* pManufacturerNameStringCharacteristic = pDeviceInformationService->createCharacteristic( MANUFACTURER_NAME_STRING_CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_READ );
pManufacturerNameStringCharacteristic->setAccessPermissions(ESP_GATT_PERM_READ_ENCRYPTED | ESP_GATT_PERM_WRITE_ENCRYPTED);
pManufacturerNameStringCharacteristic->addDescriptor( new BLE2902() );
pManufacturerNameStringCharacteristic->setValue("Lily Go");
// Create manufacturer name string Characteristic -
BLECharacteristic* pFirmwareRevisionStringCharacteristic = pDeviceInformationService->createCharacteristic( FIRMWARE_REVISION_STRING_CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_READ );
pFirmwareRevisionStringCharacteristic->setAccessPermissions(ESP_GATT_PERM_READ_ENCRYPTED | ESP_GATT_PERM_WRITE_ENCRYPTED);
pFirmwareRevisionStringCharacteristic->addDescriptor( new BLE2902() );
pFirmwareRevisionStringCharacteristic->setValue(__FIRMWARE__);
// Start battery service
pDeviceInformationService->start();
// Start advertising battery service
pServer->getAdvertising()->addServiceUUID( pDeviceInformationService->getUUID() );
// Create battery service
BLEService *pBatteryService = pServer->createService(BATTERY_SERVICE_UUID);
// Create a BLE battery service, batttery level Characteristic -
pBatteryLevelCharacteristic = pBatteryService->createCharacteristic( BATTERY_LEVEL_CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_NOTIFY );
pBatteryLevelCharacteristic->setAccessPermissions(ESP_GATT_PERM_READ_ENCRYPTED | ESP_GATT_PERM_WRITE_ENCRYPTED);
pBatteryLevelCharacteristic->addDescriptor( new BLEDescriptor(BATTERY_LEVEL_DESCRIPTOR_UUID) );
pBatteryLevelCharacteristic->addDescriptor( new BLE2902() );
pBatteryPowerStateCharacteristic = pBatteryService->createCharacteristic( BATTERY_POWER_STATE_CHARACTERISTIC_UUID, BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_NOTIFY );
pBatteryPowerStateCharacteristic->setAccessPermissions(ESP_GATT_PERM_READ_ENCRYPTED | ESP_GATT_PERM_WRITE_ENCRYPTED);
pBatteryPowerStateCharacteristic->addDescriptor( new BLE2902() );
// Start battery service
pBatteryService->start();
// Start advertising battery service
pServer->getAdvertising()->addServiceUUID( pBatteryService->getUUID() );

View File

@@ -30,7 +30,6 @@
#define CHARACTERISTIC_UUID_RX BLEUUID("6E400002-B5A3-F393-E0A9-E50E24DCCA9E")
#define CHARACTERISTIC_UUID_TX BLEUUID("6E400003-B5A3-F393-E0A9-E50E24DCCA9E")
#define DEVICE_INFORMATION_SERVICE_UUID BLEUUID((uint16_t)0x180A) // Device Information server UUID
#define MANUFACTURER_NAME_STRING_CHARACTERISTIC_UUID BLEUUID((uint16_t)0x2A29) // Device Information - manufacturer name string UUID
#define FIRMWARE_REVISION_STRING_CHARACTERISTIC_UUID BLEUUID((uint16_t)0x2A26) // Device Information - firmware revision UUID
@@ -40,7 +39,6 @@
#define BATTERY_LEVEL_DESCRIPTOR_UUID BLEUUID((uint16_t)0x2901) // battery level descriptor UUID
#define BATTERY_POWER_STATE_CHARACTERISTIC_UUID BLEUUID((uint16_t)0x2A1A) // battery power state characteristic UUID
#define BATTERY_POWER_STATE_BATTERY_UNKNOWN 0x0
#define BATTERY_POWER_STATE_BATTERY_NOT_SUPPORTED 0x1
#define BATTERY_POWER_STATE_BATTERY_NOT_PRESENT 0x2
@@ -61,8 +59,6 @@
#define BATTERY_POWER_STATE_LEVEL_GOOD 0x80
#define BATTERY_POWER_STATE_LEVEL_CRITICALLY_LOW 0xC0
#define BLECTL_JSON_COFIG_FILE "/blectl.json"
#define EndofText 0x03
@@ -123,7 +119,7 @@
bool blectl_get_advertising( void );
void blectl_save_config( void );
void blectl_read_config( void );
void blectl_update_battery( int32_t percent, bool charging, bool plug );
#endif // _BLECTL_H

View File

@@ -76,6 +76,8 @@ void sound_setup( void ) {
}
void sound_Task( void * pvParameters ) {
log_i("start sound task, heap: %d", ESP.getFreeHeap() );
esp_err_t err;
size_t written = 0;
@@ -84,5 +86,7 @@ void sound_Task( void * pvParameters ) {
log_e("Failed write bytes: %d\r\n", err );
}
i2s_stop( I2S_PORT );
log_i("finish sound task, heap: %d", ESP.getFreeHeap() );
vTaskDelete( NULL );
}

View File

@@ -177,7 +177,7 @@ void timesyncToRTC( void ) {
}
void timesync_Task( void * pvParameters ) {
log_i("start time sync task");
log_i("start time sync task, heap: %d", ESP.getFreeHeap() );
if ( xEventGroupGetBits( time_event_handle ) & TIME_SYNC_REQUEST ) {
struct tm info;
@@ -195,5 +195,6 @@ void timesync_Task( void * pvParameters ) {
}
}
xEventGroupClearBits( time_event_handle, TIME_SYNC_REQUEST );
log_i("finish time sync task, heap: %d", ESP.getFreeHeap() );
vTaskDelete( NULL );
}

View File

@@ -337,6 +337,10 @@ void wifictl_register_cb( EventBits_t event, WIFICTL_CALLBACK_FUNC wifictl_event
*
*/
void wifictl_send_event_cb( EventBits_t event, char *msg ) {
if ( wifictl_event_cb_entrys == 0 ) {
return;
}
for ( int entry = 0 ; entry < wifictl_event_cb_entrys ; entry++ ) {
yield();
if ( event & wifictl_event_cb_table[ entry ].event ) {
@@ -458,7 +462,7 @@ void wifictl_off( void ) {
yield();
}
if ( !wifictl_get_event( WIFICTL_ACTIVE ) ) {
if ( !wifictl_get_event( WIFICTL_ACTIVE | WIFICTL_SCAN | WIFICTL_WPS_REQUEST | WIFICTL_CONNECT ) ) {
log_i("wifictl not active");
return;
}
@@ -516,6 +520,8 @@ void wifictl_Task( void * pvParameters ) {
if ( wifi_init == false )
return;
log_i("start wifictl task, heap: %d", ESP.getFreeHeap() );
while ( true ) {
vTaskDelay( 500 );
if ( wifictl_get_event( WIFICTL_OFF_REQUEST ) && wifictl_get_event( WIFICTL_ON_REQUEST ) ) {

Binary file not shown.

View File

@@ -1 +1 @@
{"version":"2020082302","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}
{"version":"2020082401","host":"http://www.neo-guerillaz.de","file":"ttgo-t-watch2020_v1.ino.bin"}