@@ -45,23 +45,6 @@ const char* exceptionCodes[] = {
4545 "" ,
4646 "GATEWAY PATH\nUNAVAILABLE"
4747 "GATEWAY TARGET DEVICE\nFAILED TO RESPOND" };
48-
49- uint16_t getCRC (uint8_t * buf , uint8_t len ) {
50- uint16_t crc = 0xFFFF ;
51-
52- for (int pos = 0 ; pos < len ; pos ++ ) {
53- crc ^= (uint16_t )buf [pos ];
54-
55- for (int i = 8 ; i != 0 ; i -- ) {
56- if ((crc & 0x0001 ) != 0 ) {
57- crc >>= 1 ;
58- crc ^= 0xA001 ;
59- } else
60- crc >>= 1 ;
61- }
62- }
63- return crc ;
64- }
6548////////////////////////// ViewDispatcher Callbacks //////////////////////////
6649static bool CustomEventCB (void * context , uint32_t event ) {
6750 furi_assert (context );
@@ -196,18 +179,22 @@ void modbus_app_free(App* app) {
196179 storage_file_free (app -> LOGfile );
197180 furi_record_close (RECORD_STORAGE );
198181 furi_record_close (RECORD_DIALOGS );
182+ furi_record_close (RECORD_EXPANSION );
183+ expansion_enable (app -> expansion );
199184 free (app );
200185}
201186
202187////////////////////////// Entry Point //////////////////////////
203188int32_t Modbus_app (void * p ) {
204189 UNUSED (p );
190+ App * app = modbus_app_alloc ();
191+ Gui * gui = furi_record_open (RECORD_GUI );
192+ app -> expansion = furi_record_open (RECORD_EXPANSION );
193+ expansion_disable (app -> expansion );
205194 furi_hal_gpio_init_simple (& gpio_ext_pc0 , GpioModeOutputPushPull );
206195 furi_hal_gpio_init_simple (& gpio_ext_pc1 , GpioModeOutputPushPull );
207196 furi_hal_gpio_write (& gpio_ext_pc0 , 0 );
208197 furi_hal_gpio_write (& gpio_ext_pc1 , 0 );
209- App * app = modbus_app_alloc ();
210- Gui * gui = furi_record_open (RECORD_GUI );
211198 view_dispatcher_attach_to_gui (app -> viewDispatcher , gui , ViewDispatcherTypeFullscreen );
212199 scene_manager_next_scene (app -> sceneManager , app_scene_main );
213200 view_dispatcher_run (app -> viewDispatcher );
0 commit comments