forked from csete/gpredict
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The implementation is based on https://github.com/Xerbo/Lucky7-Decoder This closes csete#192
- Loading branch information
1 parent
7043490
commit b68446c
Showing
6 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright 2020 Daniel Estevez <[email protected]> | ||
# | ||
# This file is part of gr-satellites | ||
# | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
# Based on the decoder by Xerbo | ||
# https://github.com/Xerbo/Lucky7-Decoder | ||
|
||
import struct | ||
|
||
from .imagereceiver import ImageReceiver | ||
|
||
class ImageReceiverLucky7(ImageReceiver): | ||
def chunk_sequence(self, chunk): | ||
return struct.unpack('>H', chunk[3:5])[0] | ||
|
||
def chunk_size(self): | ||
return 28 | ||
|
||
def chunk_data(self, chunk): | ||
return chunk[7:] | ||
|
||
def file_size(self, chunk): | ||
return self.chunk_size() * struct.unpack('>H', chunk[5:7])[0] | ||
|
||
def parse_chunk(self, chunk): | ||
address = struct.unpack('>H', chunk[1:3])[0] | ||
if address < 0xC000 \ | ||
or address >= 0xC000 + self.file_size(chunk)/self.chunk_size(): | ||
return None | ||
return chunk | ||
|
||
lucky7 = ImageReceiverLucky7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters