[FL-2778] SubGhz: fix CLI "subghz tx" (#1681)
* SubGhz: fix CLI "subghz tx" * Fix qoutes in amap workflow * Github: fix step naming * fix quotes in PR name again Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: DrunkBatya <drunkbatya.js@gmail.com>
This commit is contained in:
		
							parent
							
								
									8e9043003f
								
							
						
					
					
						commit
						e7a5d19f9c
					
				
							
								
								
									
										16
									
								
								.github/workflows/amap_analyse.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/amap_analyse.yml
									
									
									
									
										vendored
									
									
								
							| @ -45,6 +45,19 @@ jobs: | |||||||
|           fetch-depth: 0 |           fetch-depth: 0 | ||||||
|           ref: ${{ github.event.pull_request.head.sha }} |           ref: ${{ github.event.pull_request.head.sha }} | ||||||
| 
 | 
 | ||||||
|  |       - name: 'Escape pull request title' | ||||||
|  |         if: github.event_name == 'pull_request' | ||||||
|  |         run: | | ||||||
|  |           import json | ||||||
|  |           import os | ||||||
|  |           import shlex | ||||||
|  |           with open('${{ github.event_path }}') as fh: | ||||||
|  |               event = json.load(fh) | ||||||
|  |           escaped = shlex.quote(event['pull_request']['title']) | ||||||
|  |           with open(os.environ['GITHUB_ENV'], 'a') as fh: | ||||||
|  |               print(f'PULL_NAME={escaped}', file=fh) | ||||||
|  |         shell: python3 {0} | ||||||
|  | 
 | ||||||
|       - name: 'Generate prefixes by commit' |       - name: 'Generate prefixes by commit' | ||||||
|         id: names |         id: names | ||||||
|         run: | |         run: | | ||||||
| @ -58,7 +71,6 @@ jobs: | |||||||
|             SHA="$(cut -c -8 <<< "$COMMIT_HASH")" |             SHA="$(cut -c -8 <<< "$COMMIT_HASH")" | ||||||
|             COMMIT_MSG="$(git log -1 --pretty=format:"%s")" |             COMMIT_MSG="$(git log -1 --pretty=format:"%s")" | ||||||
|             PULL_ID="${{github.event.pull_request.number}}" |             PULL_ID="${{github.event.pull_request.number}}" | ||||||
|             PULL_NAME="${{github.event.pull_request.title}}" |  | ||||||
|           fi |           fi | ||||||
|           BRANCH_NAME=${REF#refs/*/} |           BRANCH_NAME=${REF#refs/*/} | ||||||
|           SUFFIX=${BRANCH_NAME//\//_}-$(date +'%d%m%Y')-${SHA} |           SUFFIX=${BRANCH_NAME//\//_}-$(date +'%d%m%Y')-${SHA} | ||||||
| @ -78,7 +90,6 @@ jobs: | |||||||
|           mkdir artifacts |           mkdir artifacts | ||||||
| 
 | 
 | ||||||
|       - name: 'Download build artifacts' |       - name: 'Download build artifacts' | ||||||
|         if: ${{ !github.event.pull_request.head.repo.fork }} |  | ||||||
|         run: | |         run: | | ||||||
|           echo "${{ secrets.RSYNC_DEPLOY_KEY }}" > deploy_key; |           echo "${{ secrets.RSYNC_DEPLOY_KEY }}" > deploy_key; | ||||||
|           chmod 600 ./deploy_key; |           chmod 600 ./deploy_key; | ||||||
| @ -112,7 +123,6 @@ jobs: | |||||||
|           export FREE_FLASH_SIZE="$(get_size ".free_flash")" |           export FREE_FLASH_SIZE="$(get_size ".free_flash")" | ||||||
|           if [[ ${{ github.event_name }} == 'pull_request' ]]; then |           if [[ ${{ github.event_name }} == 'pull_request' ]]; then | ||||||
|             export PULL_ID="${{steps.names.outputs.pull-id}}" |             export PULL_ID="${{steps.names.outputs.pull-id}}" | ||||||
|             export PULL_NAME="${{steps.names.outputs.pull-name}}" |  | ||||||
|           fi |           fi | ||||||
|           python3 -m pip install mariadb |           python3 -m pip install mariadb | ||||||
|           python3 scripts/amap_mariadb_insert.py \ |           python3 scripts/amap_mariadb_insert.py \ | ||||||
|  | |||||||
| @ -114,19 +114,21 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) { | |||||||
|     uint32_t frequency = 433920000; |     uint32_t frequency = 433920000; | ||||||
|     uint32_t key = 0x0074BADE; |     uint32_t key = 0x0074BADE; | ||||||
|     uint32_t repeat = 10; |     uint32_t repeat = 10; | ||||||
|  |     uint32_t te = 403; | ||||||
| 
 | 
 | ||||||
|     if(string_size(args)) { |     if(string_size(args)) { | ||||||
|         int ret = sscanf(string_get_cstr(args), "%lx %lu %lu", &key, &frequency, &repeat); |         int ret = sscanf(string_get_cstr(args), "%lx %lu %lu %lu", &key, &frequency, &te, &repeat); | ||||||
|         if(ret != 3) { |         if(ret != 4) { | ||||||
|             printf( |             printf( | ||||||
|                 "sscanf returned %d, key: %lx, frequency: %lu, repeat: %lu\r\n", |                 "sscanf returned %d, key: %lx, frequency: %lu, te:%lu, repeat: %lu\r\n", | ||||||
|                 ret, |                 ret, | ||||||
|                 key, |                 key, | ||||||
|                 frequency, |                 frequency, | ||||||
|  |                 te, | ||||||
|                 repeat); |                 repeat); | ||||||
|             cli_print_usage( |             cli_print_usage( | ||||||
|                 "subghz tx", |                 "subghz tx", | ||||||
|                 "<3 Byte Key: in hex> <Frequency: in Hz> <Repeat count>", |                 "<3 Byte Key: in hex> <Frequency: in Hz> <Te us> <Repeat count>", | ||||||
|                 string_get_cstr(args)); |                 string_get_cstr(args)); | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| @ -139,9 +141,10 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     printf( |     printf( | ||||||
|         "Transmitting at %lu, key %lx, repeat %lu. Press CTRL+C to stop\r\n", |         "Transmitting at %lu, key %lx, te %lu, repeat %lu. Press CTRL+C to stop\r\n", | ||||||
|         frequency, |         frequency, | ||||||
|         key, |         key, | ||||||
|  |         te, | ||||||
|         repeat); |         repeat); | ||||||
| 
 | 
 | ||||||
|     string_t flipper_format_string; |     string_t flipper_format_string; | ||||||
| @ -149,12 +152,13 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) { | |||||||
|         flipper_format_string, |         flipper_format_string, | ||||||
|         "Protocol: Princeton\n" |         "Protocol: Princeton\n" | ||||||
|         "Bit: 24\n" |         "Bit: 24\n" | ||||||
|         "Key: 00 00 00 00 00 %X %X %X\n" |         "Key: 00 00 00 00 00 %02X %02X %02X\n" | ||||||
|         "TE: 403\n" |         "TE: %d\n" | ||||||
|         "Repeat: %d\n", |         "Repeat: %d\n", | ||||||
|         (uint8_t)((key >> 16) & 0xFF), |         (uint8_t)((key >> 16) & 0xFF), | ||||||
|         (uint8_t)((key >> 8) & 0xFF), |         (uint8_t)((key >> 8) & 0xFF), | ||||||
|         (uint8_t)(key & 0xFF), |         (uint8_t)(key & 0xFF), | ||||||
|  |         te, | ||||||
|         repeat); |         repeat); | ||||||
|     FlipperFormat* flipper_format = flipper_format_string_alloc(); |     FlipperFormat* flipper_format = flipper_format_string_alloc(); | ||||||
|     Stream* stream = flipper_format_get_raw_stream(flipper_format); |     Stream* stream = flipper_format_get_raw_stream(flipper_format); | ||||||
| @ -425,7 +429,7 @@ static void subghz_cli_command_print_usage() { | |||||||
| 
 | 
 | ||||||
|     printf("\tchat <frequency:in Hz>\t - Chat with other Flippers\r\n"); |     printf("\tchat <frequency:in Hz>\t - Chat with other Flippers\r\n"); | ||||||
|     printf( |     printf( | ||||||
|         "\ttx <3 byte Key: in hex> <frequency: in Hz> <repeat: count>\t - Transmitting key\r\n"); |         "\ttx <3 byte Key: in hex> <frequency: in Hz> <te: us> <repeat: count>\t - Transmitting key\r\n"); | ||||||
|     printf("\trx <frequency:in Hz>\t - Reception key\r\n"); |     printf("\trx <frequency:in Hz>\t - Reception key\r\n"); | ||||||
|     printf("\tdecode_raw <file_name: path_RAW_file>\t - Testing\r\n"); |     printf("\tdecode_raw <file_name: path_RAW_file>\t - Testing\r\n"); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Skorpionm
						Skorpionm