rmk icon indicating copy to clipboard operation
rmk copied to clipboard

Feat/sleep event

Open pcasotti opened this issue 2 months ago • 4 comments

Publish the ControllerEvent::Sleep event when entering or waking from sleep mode.

pcasotti avatar Nov 19 '25 17:11 pcasotti

Binary Size Report

use_config/nrf52832_ble

   text	   data	    bss	    dec	    hex	filename
 313816	   5072	  32068	 350956	  55aec	rmk-nrf52832
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  -0.0%      -1  [ = ]       0    .strtab
  -0.0%      -3  [ = ]       0    .debug_str
  -6.7%      -5  [ = ]       0    [Unmapped]
  -0.0%      -7  [ = ]       0    .debug_info
  -0.0%     -16  [ = ]       0    TOTAL

use_config/nrf52840_ble

   text	   data	    bss	    dec	    hex	filename
 350788	   5072	  44676	 400536	  61c98	rmk-nrf52840
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +798  [ = ]       0    .debug_str
  +0.0%    +632  [ = ]       0    .debug_info
  +0.3%    +552  [ = ]       0    .debug_ranges
  +0.1%    +205  [ = ]       0    .debug_line
  +0.0%     +32  [ = ]       0    .strtab
  +0.0%     +16  [ = ]       0    .symtab
  [ = ]       0  +0.0%      +8    .bss
  +0.1%      +1  [ = ]       0    .defmt
  +1.6%      +1  [ = ]       0    [Unmapped]
  -0.0%     -16  [ = ]       0    .debug_frame
  -0.4% -2.47Ki  [ = ]       0    .debug_loc
  -0.0%    -312  +0.0%      +8    TOTAL

use_config/nrf52840_ble_split

   text	   data	    bss	    dec	    hex	filename
 424332	   6376	  43588	 474296	  73cb8	central

   text	   data	    bss	    dec	    hex	filename
 271684	   5740	  26068	 303492	  4a184	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.5%    +912  [ = ]       0    .debug_ranges
  +0.0%    +773  [ = ]       0    .debug_str
  +0.0%    +519  [ = ]       0    .debug_info
  +0.2%    +499  [ = ]       0    .debug_line
  +0.0%     +64  [ = ]       0    .symtab
  +0.1%     +32  [ = ]       0    .debug_aranges
  [ = ]       0  +0.0%      +8    .bss
  +0.0%      +4  [ = ]       0    .strtab
  -0.0%      -4  [ = ]       0    .debug_frame
 -10.4%      -7  [ = ]       0    [Unmapped]
  -0.0%     -56  -0.0%     -56    .text
  -0.1%    -616  [ = ]       0    .debug_loc
  +0.0% +2.07Ki  -0.0%     -48    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +1.04Ki  [ = ]       0    .debug_str
  +0.1%    +786  [ = ]       0    .debug_info
  +0.2%    +232  [ = ]       0    .debug_ranges
  +0.1%    +151  [ = ]       0    .strtab
  +0.2%    +144  [ = ]       0    .symtab
  +0.0%     +98  [ = ]       0    .debug_line
  +0.1%     +48  [ = ]       0    .debug_aranges
  +0.2%     +48  [ = ]       0    .debug_frame
  +0.0%     +16  +0.0%     +16    .text
   +29%     +14  [ = ]       0    [Unmapped]
  -0.1%    -235  [ = ]       0    .debug_loc
  +0.1% +2.31Ki  +0.0%     +16    TOTAL

use_rust/nrf52840_ble_split

   text	   data	    bss	    dec	    hex	filename
 430260	   6376	  49220	 485856	  769e0	central

   text	   data	    bss	    dec	    hex	filename
 269936	   5196	  24836	 299968	  493c0	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +1.31Ki  [ = ]       0    .debug_info
  +0.0% +1.12Ki  [ = ]       0    .debug_str
  +0.2%    +344  [ = ]       0    .debug_ranges
  +0.1%    +329  [ = ]       0    .debug_line
  +0.2%    +256  [ = ]       0    .symtab
  +0.0%    +155  [ = ]       0    .strtab
  +0.2%     +92  [ = ]       0    .debug_frame
  +0.2%     +80  [ = ]       0    .debug_aranges
  [ = ]       0  +0.0%      +8    .bss
   +13%      +6  [ = ]       0    [Unmapped]
  -0.0%     -40  -0.0%     -40    .text
  -0.3% -1.59Ki  [ = ]       0    .debug_loc
  +0.0% +2.03Ki  -0.0%     -32    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +218  [ = ]       0    .debug_str
  +0.2%    +208  [ = ]       0    .symtab
  +0.1%    +183  [ = ]       0    .strtab
  +0.2%     +64  [ = ]       0    .debug_frame
  +0.2%     +56  [ = ]       0    .debug_aranges
  +0.0%     +40  +0.0%     +40    .text
 -17.5%     -11  [ = ]       0    [Unmapped]
  -0.1%     -96  [ = ]       0    .debug_ranges
  -0.1%    -124  [ = ]       0    .debug_line
  -0.0%    -371  [ = ]       0    .debug_info
  -0.1%    -391  [ = ]       0    .debug_loc
  -0.0%    -224  +0.0%     +40    TOTAL

use_config/pi_pico_w_ble

   text	   data	    bss	    dec	    hex	filename
 585872	      0	  53500	 639372	  9c18c	rmk-pi-pico-w
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%      +4  [ = ]       0    .strtab
  +0.0%      +1  [ = ]       0    .debug_str
  -1.6%      -1  [ = ]       0    [Unmapped]
  -0.0%      -2  [ = ]       0    .debug_line
  -0.0%      -6  [ = ]       0    .debug_info
  -0.0%      -4  [ = ]       0    TOTAL

use_config/pi_pico_w_ble_split

   text	   data	    bss	    dec	    hex	filename
 618656	      0	  60140	 678796	  a5b8c	central

   text	   data	    bss	    dec	    hex	filename
 483588	      0	  42128	 525716	  80594	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0% +1.16Ki  [ = ]       0    .debug_str
  +0.0%    +675  [ = ]       0    .debug_info
  +0.1%    +136  [ = ]       0    .debug_ranges
  +0.0%     +32  [ = ]       0    .symtab
  +0.0%     +16  [ = ]       0    .debug_aranges
  [ = ]       0  +0.0%      +8    .bss
  +0.1%      +1  [ = ]       0    .defmt
 -24.6%     -15  [ = ]       0    [Unmapped]
  -0.0%     -24  [ = ]       0    .strtab
  -0.1%     -36  [ = ]       0    .debug_frame
  -0.0%     -65  [ = ]       0    .debug_line
  -0.0%    -116  -0.0%    -116    .text
  -0.2% -1.43Ki  [ = ]       0    .debug_loc
  +0.0%    +324  -0.0%    -108    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +797  [ = ]       0    .debug_loc
  +0.0%    +434  [ = ]       0    .debug_str
  +0.0%     +57  [ = ]       0    .strtab
  +0.0%     +40  [ = ]       0    .debug_ranges
  +0.1%     +24  [ = ]       0    .debug_aranges
  +0.0%     +24  +0.0%     +24    .text
  +0.0%     +16  [ = ]       0    .symtab
   +26%      +9  [ = ]       0    [Unmapped]
  +0.2%      +1  [ = ]       0    .defmt
  -0.0%     -31  [ = ]       0    .debug_line
  -0.0%    -335  [ = ]       0    .debug_info
  +0.0% +1.01Ki  +0.0%     +24    TOTAL

use_rust/pi_pico_w_ble_split

   text	   data	    bss	    dec	    hex	filename
 618576	      0	  60460	 679036	  a5c7c	central

   text	   data	    bss	    dec	    hex	filename
 483676	      0	  42136	 525812	  805f4	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0% +1.17Ki  [ = ]       0    .debug_str
  +0.0%    +758  [ = ]       0    .debug_info
  +0.1%    +136  [ = ]       0    .debug_ranges
  +0.0%     +32  [ = ]       0    .symtab
   +48%     +21  [ = ]       0    [Unmapped]
  +0.0%     +16  [ = ]       0    .debug_aranges
  [ = ]       0  +0.0%      +8    .bss
  +0.1%      +1  [ = ]       0    .defmt
  -0.0%     -24  [ = ]       0    .strtab
  -0.1%     -36  [ = ]       0    .debug_frame
  -0.0%     -81  [ = ]       0    .debug_line
  -0.0%     -84  -0.0%     -84    .text
  -0.2% -1.42Ki  [ = ]       0    .debug_loc
  +0.0%    +476  -0.0%     -76    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +434  [ = ]       0    .debug_str
  +0.1%    +415  [ = ]       0    .debug_loc
  +0.0%     +51  [ = ]       0    .strtab
  +0.0%     +40  [ = ]       0    .debug_ranges
  +0.1%     +24  [ = ]       0    .debug_aranges
  +0.0%     +24  +0.0%     +24    .text
   +13%      +6  [ = ]       0    [Unmapped]
  +0.2%      +1  [ = ]       0    .defmt
  -0.0%     -16  [ = ]       0    .symtab
  -0.0%     -31  [ = ]       0    .debug_line
  -0.4%     -32  [ = ]       0    .debug_abbrev
  -0.0%    -352  [ = ]       0    .debug_info
  +0.0%    +564  +0.0%     +24    TOTAL

use_config/rp2040

   text	   data	    bss	    dec	    hex	filename
 132340	      0	  14892	 147232	  23f20	rmk-rp2040
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +6.9%      +4  [ = ]       0    [Unmapped]
  -0.0%      -3  [ = ]       0    .strtab
  -0.0%      -5  [ = ]       0    .debug_str
  -0.0%      -4  [ = ]       0    TOTAL

use_config/rp2040_split

   text	   data	    bss	    dec	    hex	filename
 145756	      0	  16352	 162108	  2793c	central

   text	   data	    bss	    dec	    hex	filename
  34024	      0	   2832	  36856	   8ff8	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +97  [ = ]       0    .debug_info
  +0.0%     +49  [ = ]       0    .debug_str
   +26%     +11  [ = ]       0    [Unmapped]
  -0.3%      -1  [ = ]       0    .defmt
  -0.0%      -8  -0.0%      -8    .text
  -0.0%     -16  [ = ]       0    .symtab
  -0.0%     -19  [ = ]       0    .debug_line
  -0.0%     -38  [ = ]       0    .debug_loc
  -0.2%    -235  [ = ]       0    .strtab
  -0.0%    -160  -0.0%      -8    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.6%    +270  [ = ]       0    .debug_loc
  +0.0%    +148  [ = ]       0    .debug_str
  +0.2%     +67  [ = ]       0    .strtab
  +0.2%     +16  [ = ]       0    .symtab
  +0.0%     +12  +0.0%     +12    .text
  [ = ]       0  +0.4%      +8    .bss
  +1.5%      +2  [ = ]       0    .defmt
  -0.1%      -8  [ = ]       0    .debug_aranges
 -24.1%     -13  [ = ]       0    [Unmapped]
  -0.5%     -28  [ = ]       0    .debug_frame
  -0.5%     -64  [ = ]       0    .debug_ranges
  -0.2%    -526  [ = ]       0    .debug_info
  -0.0%    -124  +0.1%     +20    TOTAL

use_rust/rp2040_split

   text	   data	    bss	    dec	    hex	filename
 144908	      0	  15948	 160856	  27458	central

   text	   data	    bss	    dec	    hex	filename
  34540	      0	   3080	  37620	   92f4	peripheral
Diff

Central Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +87  [ = ]       0    .debug_info
  +0.0%     +49  [ = ]       0    .debug_str
  +0.0%     +42  [ = ]       0    .debug_loc
  -0.3%      -1  [ = ]       0    .defmt
  -0.0%      -8  -0.0%      -8    .text
  -0.0%     -16  [ = ]       0    .symtab
  -0.0%     -20  [ = ]       0    .debug_line
 -40.6%     -26  [ = ]       0    [Unmapped]
  -0.2%    -235  [ = ]       0    .strtab
  -0.0%    -128  -0.0%      -8    TOTAL

Peripheral Diff

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +148  [ = ]       0    .debug_str
  +0.2%     +67  [ = ]       0    .strtab
  +0.1%     +43  [ = ]       0    .debug_line
  +0.2%     +16  [ = ]       0    .symtab
  [ = ]       0  +0.4%      +8    .bss
  +1.5%      +2  [ = ]       0    .defmt
  -0.1%      -8  [ = ]       0    .debug_aranges
  -0.5%     -28  [ = ]       0    .debug_frame
 -45.2%     -28  [ = ]       0    [Unmapped]
  -0.1%     -40  -0.1%     -40    .text
  -0.9%    -128  [ = ]       0    .debug_ranges
  -0.1%    -337  [ = ]       0    .debug_info
  -1.2%    -559  [ = ]       0    .debug_loc
  -0.1%    -852  -0.1%     -32    TOTAL

use_config/stm32f1

   text	   data	    bss	    dec	    hex	filename
  51076	     24	   6824	  57924	   e244	rmk-stm32f1
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +1.8%      +1  [ = ]       0    [Unmapped]
  -0.0%      -1  [ = ]       0    .debug_line
  [ = ]       0  [ = ]       0    TOTAL

use_config/stm32f4

   text	   data	    bss	    dec	    hex	filename
 137860	    320	  16216	 154396	  25b1c	rmk-stm32f4
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +78  [ = ]       0    .debug_info
   +31%     +11  [ = ]       0    [Unmapped]
  -0.3%      -1  [ = ]       0    .defmt
  -0.0%      -8  [ = ]       0    .debug_aranges
  -0.0%      -8  -0.0%      -8    .text
  -0.0%     -15  [ = ]       0    .debug_line
  -0.0%     -16  [ = ]       0    .symtab
  -0.0%     -38  [ = ]       0    .debug_loc
  -0.0%    -129  [ = ]       0    .debug_str
  -0.2%    -230  [ = ]       0    .strtab
  -0.0%    -356  -0.0%      -8    TOTAL

use_config/stm32h7

   text	   data	    bss	    dec	    hex	filename
 123824	    264	  15432	 139520	  22100	rmk-stm32h7
Diff
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +102  [ = ]       0    .debug_info
  +0.0%      +4  +0.0%      +4    .text
  -6.7%      -4  [ = ]       0    [Unmapped]
  -0.0%     -10  [ = ]       0    .debug_str
  -0.0%     -18  [ = ]       0    .debug_line
  -0.0%     -38  [ = ]       0    .debug_loc
  -0.2%    -116  [ = ]       0    .strtab
  -0.0%     -80  +0.0%      +4    TOTAL

github-actions[bot] avatar Nov 19 '25 17:11 github-actions[bot]

Now I'm a little worry about the number of controller publisher/subscriber, I don't know how to calculate the maximum number of publishers/subscribers that the project use. Maybe we should manage them in a single place to avoid runtime panic of unwrap!(CONTROLLER_CHANNEL.publisher());.

HaoboGu avatar Nov 20 '25 02:11 HaoboGu

Maybe we should manage them in a single place to avoid runtime panic of unwrap!(CONTROLLER_CHANNEL.publisher());.

You mean like a global publisher under a mutex? Seems good, but I don't know how the mutex overhead will affect performance, probably not by much.

pcasotti avatar Nov 20 '25 02:11 pcasotti

You mean like a global publisher under a mutex

I mean a manager which knows how many publishers is used and pre-assigns all publishers. IMO the best way is to calculate the number of publishers/subscribers at the compile-time, but I don't know whether it is possible

HaoboGu avatar Nov 20 '25 02:11 HaoboGu