xlxs
This commit is contained in:
@@ -7,7 +7,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/k0kubun/pp/v3"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/tealeg/xlsx"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
"starwiz.cn/sjy01/preprocessing/calculator"
|
||||
)
|
||||
@@ -129,7 +130,7 @@ type AuxPlatform struct {
|
||||
SS1_ExtenalImage bool // [407.(1)] 星敏1外部图像标志位 0x01:外部图像;0x00:关闭
|
||||
SS1_AttitudeActive bool // [407.(0)] 星敏1姿态有效标志位 0x01:激活;0x00:关闭
|
||||
SS1_ImgFrmNo uint32 // [411-413] 星敏1图像帧号
|
||||
SS1_XAV float64 // [417-418] 星敏1X方向角速度 单位:2-11 °/s
|
||||
SS1_XAV float64 // [417-418] 星敏1X方向角速度 单位:2e-11 °/s
|
||||
SS1_YAV float64 // [419-420]
|
||||
SS1_ZAV float64 // [421-422]
|
||||
SS2_UTCTime uint32 // [424-427] 星敏2 UTC时间
|
||||
@@ -170,7 +171,7 @@ type AuxPlatform struct {
|
||||
CheckSum byte // [512] 校验和
|
||||
}
|
||||
|
||||
func (ap *AuxPlatform) Parse(data []byte) error {
|
||||
func (ap *AuxPlatform) Decode(data []byte) error {
|
||||
if len(data) < 512 {
|
||||
return ErrAuxPlatformDataLen
|
||||
}
|
||||
@@ -337,19 +338,23 @@ func (ap AuxPlatform) Print() {
|
||||
pp.Println(ap)
|
||||
}
|
||||
|
||||
func (ap AuxPlatform) SaveXlsx(row *xlsx.Row) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Extractor 辅助数据提取器
|
||||
// auxfile 辅助数据文件路径
|
||||
func (e *Extractor) ParseAuxPlatform(auxfile string) ([]*AuxPlatform, error) {
|
||||
data, err := os.ReadFile(auxfile)
|
||||
if err != nil {
|
||||
logrus.Println("read aux data from", auxfile, "error:", err.Error())
|
||||
log.Println("read aux data from", auxfile, "error:", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var aps []*AuxPlatform
|
||||
for i := 0; i < len(data); i += 24 + 128 + 512 {
|
||||
ap := AuxPlatform{}
|
||||
if err := ap.Parse(data[i+24+128 : i+24+128+512]); err != nil {
|
||||
if err := ap.Decode(data[i+24+128 : i+24+128+512]); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -387,7 +392,7 @@ func (e *Extractor) ParseAuxPlatform(auxfile string) ([]*AuxPlatform, error) {
|
||||
func (e *Extractor) ParseAuxPlatformWithHead(auxfile string) ([]*AuxPlatform, error) {
|
||||
data, err := os.ReadFile(auxfile)
|
||||
if err != nil {
|
||||
logrus.Println("read aux data from", auxfile, "error:", err.Error())
|
||||
log.Println("read aux data from", auxfile, "error:", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user