Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split obc time config header #583

Merged
merged 4 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions System/TaskManager/task_dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "../../TlmCmd/common_cmd_packet_util.h"
#include "../ModeManager/mode_manager.h"
#include "../TimeManager/time_manager.h"
#include "../TimeManager/obc_time_config.h"
#include "../EventManager/event_logger.h"
#include <src_user/TlmCmd/block_command_definitions.h>
#include <src_user/TlmCmd/command_definitions.h>
Expand Down
1 change: 1 addition & 0 deletions System/TimeManager/obc_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @brief OBCの時刻情報の定義と演算
*/
#include "obc_time.h"
#include "obc_time_config.h"
#include "../../Library/print.h"

ObcTime OBCT_create(cycle_t total_cycle,
Expand Down
8 changes: 0 additions & 8 deletions System/TimeManager/obc_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@

#include <stdint.h>

// step, cycleについてはTimeManagerを参照のこと
#define OBCT_STEP_IN_MSEC (1) //!< 1 step で何 ms か
#define OBCT_STEPS_PER_CYCLE (100) //!< 何 step で 1 cycle か
#define OBCT_CYCLES_PER_SEC (1000 / OBCT_STEP_IN_MSEC / OBCT_STEPS_PER_CYCLE) //!< 1 s で何 cycle か
#define OBCT_MAX_CYCLE (0xfffffff0u) //!< 最大 cycle 数.つまり TI がいくつでオーバーフローするか

#include <src_user/Settings/System/obc_time_params.h>

typedef uint32_t cycle_t;
typedef uint32_t step_t;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実はこのtypedefもconfigかも?(将来的にはここの型サイズもuser設定にしたい気がしている.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

メモリくうし,step_tはu8のuserがいてもいいじゃん,的な

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いやー,それは意味合いがかなり変わってくるので,少なくとも今はやめたい

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

認識合わせたいので1つ質問なんだけど,
define のパラメタは config だけど, typedef って何になるんだ?(Cのtypedef,コンテキストが深すぎて,どう捉えていいか謎い)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

どこまでがユーザ定義なのかを明確に分割したい,というのがそもそもの目的であって,将来的にユーザ定義にする かもしれない ものをユーザ定義のものであるかのように扱うべきではない(現状そうでないし,するとしてもそう変更する時にやるべき)

あと,ここがユーザ定義になってしまうと ObcTime が実質的にユーザ定義になってしまうので,この分離があんまりうれしくなくなる

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

型変わってしまうので個人的には typedef してるようなものをユーザ定義にはしたくない寄り.それでメモリ切り詰められるとかは確かにあるかもしれないけれど,発生する複雑性に対して得られるメリットがそこまであるかは結構疑問だし,アリだったとしても早すぎる最適化の類に思ってしまう.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほどね,理解


Expand Down
14 changes: 14 additions & 0 deletions System/TimeManager/obc_time_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef OBC_TIME_CONFIG_H_
#define OBC_TIME_CONFIG_H_

// step, cycleについてはTimeManagerを参照のこと
// デフォルト設定
#define OBCT_STEP_IN_MSEC (1) //!< 1 step で何 ms か
#define OBCT_STEPS_PER_CYCLE (100) //!< 何 step で 1 cycle か
#define OBCT_CYCLES_PER_SEC (1000 / OBCT_STEP_IN_MSEC / OBCT_STEPS_PER_CYCLE) //!< 1 s で何 cycle か
#define OBCT_MAX_CYCLE (0xfffffff0u) //!< 最大 cycle 数.つまり TI がいくつでオーバーフローするか

// user 設定
#include <src_user/Settings/System/obc_time_params.h>

#endif // OBC_TIME_CONFIG_H_
1 change: 1 addition & 0 deletions System/TimeManager/time_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* @brief OBC時刻のカウントアップと,各種衛星時刻関連処理
*/
#include "time_manager.h"
#include "obc_time_config.h"
#include <string.h>
#include "../../Library/c2a_round.h"
#include "../TaskManager/task_dispatcher.h"
Expand Down