highly experimental bluetooth, try gadgetbridge

This commit is contained in:
sharandac
2020-08-12 20:12:21 +02:00
parent aeb15d34a8
commit 4bb56c8b58
11 changed files with 49 additions and 29 deletions

View File

@@ -27,30 +27,34 @@
lv_setup_entry_t setup_entry[ MAX_SETUP_ICON ];
lv_obj_t *setup_cont = NULL;
lv_obj_t *setup_cont[ MAX_SETUP_TILES ];
uint32_t setup_tile_num[ MAX_SETUP_TILES ];
lv_style_t setup_style;
uint32_t setup_tile_num;
void setup_tile_setup( void ) {
setup_tile_num = mainbar_add_tile( 1, 1 );
setup_cont = mainbar_get_tile_obj( setup_tile_num );
for ( int tiles = 0 ; tiles < MAX_SETUP_TILES ; tiles++ ) {
setup_tile_num[ tiles ] = mainbar_add_tile( 1 + tiles , 1 );
setup_cont[ tiles ] = mainbar_get_tile_obj( setup_tile_num[ tiles ] );
}
lv_style_copy( &setup_style, mainbar_get_style() );
for ( int setup = 0 ; setup < MAX_SETUP_ICON ; setup++ ) {
// set x, y and mark it as inactive
setup_entry[ setup ].x = SETUP_FIRST_X_POS + ( ( setup % MAX_SETUP_ICON_HORZ ) * ( SETUP_ICON_X_SIZE + SETUP_ICON_X_CLEARENCE ) );
setup_entry[ setup ].y = SETUP_FIRST_Y_POS + ( ( setup / MAX_SETUP_ICON_HORZ ) * ( SETUP_ICON_Y_SIZE + SETUP_ICON_Y_CLEARENCE ) );
setup_entry[ setup ].y = SETUP_FIRST_Y_POS + ( ( ( setup % ( MAX_SETUP_ICON_VERT * MAX_SETUP_ICON_HORZ ) ) / MAX_SETUP_ICON_HORZ ) * ( SETUP_ICON_Y_SIZE + SETUP_ICON_Y_CLEARENCE ) );
setup_entry[ setup ].active = false;
// create app icon container
setup_entry[ setup ].setup = mainbar_obj_create( setup_cont );
setup_entry[ setup ].setup = mainbar_obj_create( setup_cont[ setup / ( MAX_SETUP_ICON_HORZ * MAX_SETUP_ICON_VERT ) ] );
lv_obj_reset_style_list( setup_entry[ setup ].setup, LV_OBJ_PART_MAIN );
lv_obj_add_style( setup_entry[ setup ].setup, LV_OBJ_PART_MAIN, &setup_style );
lv_obj_set_size( setup_entry[ setup ].setup, SETUP_ICON_X_SIZE, SETUP_ICON_Y_SIZE );
lv_obj_align( setup_entry[ setup ].setup , setup_cont, LV_ALIGN_IN_TOP_LEFT, setup_entry[ setup ].x, setup_entry[ setup ].y );
lv_obj_align( setup_entry[ setup ].setup , setup_cont[ setup / ( MAX_SETUP_ICON_HORZ * MAX_SETUP_ICON_VERT ) ], LV_ALIGN_IN_TOP_LEFT, setup_entry[ setup ].x, setup_entry[ setup ].y );
lv_obj_set_hidden( setup_entry[ setup ].setup, true );
log_d("icon x/y: %d/%d", setup_entry[ setup ].x, setup_entry[ setup ].y );
log_d("icon screen/x/y: %d/%d/%d", setup / ( MAX_SETUP_ICON_HORZ * MAX_SETUP_ICON_VERT ), setup_entry[ setup ].x, setup_entry[ setup ].y );
}
}
@@ -67,5 +71,5 @@ lv_obj_t *setup_tile_register_setup( void ) {
}
uint32_t setup_get_tile_num( void ) {
return( setup_tile_num );
return( setup_tile_num[ 0 ] );
}

View File

@@ -26,7 +26,8 @@
#define MAX_SETUP_ICON_HORZ 3
#define MAX_SETUP_ICON_VERT 2
#define MAX_SETUP_ICON ( MAX_SETUP_ICON_HORZ * MAX_SETUP_ICON_VERT )
#define MAX_SETUP_TILES 2
#define MAX_SETUP_ICON ( MAX_SETUP_ICON_HORZ * MAX_SETUP_ICON_VERT * MAX_SETUP_TILES )
#define SETUP_ICON_X_SIZE 64
#define SETUP_ICON_Y_SIZE 64