Skip to content

Commit

Permalink
final submission
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPicklePinosaur committed Dec 5, 2023
1 parent 90b46e4 commit 095850f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
3 changes: 2 additions & 1 deletion kern/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ int kmain() {
kern_init();

set_log_level(LOG_LEVEL_DEBUG);
set_log_mask(LOG_MASK_KERN|LOG_MASK_USER|LOG_MASK_COHORT);
/* set_log_mask(LOG_MASK_KERN|LOG_MASK_USER|LOG_MASK_COHORT); */
set_log_mask(LOG_MASK_KERN);

// print the banner
PRINT("");
Expand Down
6 changes: 4 additions & 2 deletions user/trainstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,10 @@ cohortReverseTask()
cohort_stop(clock_server, marklin_server, leader_train);

// delay for time required by slowest stopping train
u32 max_stop_time = train_data_stop_time(leader_train, train_state[leader_train].speed) / 10 + 100;
u32 max_stop_time = train_data_stop_time(leader_train, train_state[leader_train].speed) / 10 + 200;
for (usize i = 0; i < follower_len; ++i) {
usize follower_train = (usize)cbuf_get(train_state[leader_train].followers, i);
u32 follower_stop_time = train_data_stop_time(follower_train, train_state[follower_train].speed) / 10 + 100;
u32 follower_stop_time = train_data_stop_time(follower_train, train_state[follower_train].speed) / 10 + 200;
max_stop_time = u32_max(max_stop_time, follower_stop_time);
}
Delay(clock_server, max_stop_time);
Expand Down Expand Up @@ -510,6 +510,8 @@ cohortReverseTask()
// TODO pather should set this themselves
/* cohort_set_speed(clock_server, marklin_server, new_leader, get_safe_speed(new_leader, leader_vel)); */

Delay(clock_server, 20);

// unblock the task that called reverse
TrainstateResp trainstate_reply_buf = (TrainstateResp) {
.type = TRAINSTATE_REVERSE,
Expand Down
21 changes: 12 additions & 9 deletions user/ui/prompt.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,6 @@ executeCommand(Arena* tmp, Tid marklin_server, Tid clock_server, Tid console_ren
case 5: {
renderer_append_console(console_renderer_server, "Running benchmark 5: long cohort");

const usize SPEED = 8;

const usize TRAIN1 = 2;
const usize TRAIN2 = 47;
const usize TRAIN3 = 54;
Expand All @@ -368,15 +366,20 @@ executeCommand(Arena* tmp, Tid marklin_server, Tid clock_server, Tid console_ren
break;
}
case 6: {
renderer_append_console(console_renderer_server, "Running benchmark 6: move to exit and back out");
renderer_append_console(console_renderer_server, "Running benchmark 6: longer cohort");

usize SPEED = 5;
usize TRAIN = 2;
const usize TRAIN1 = 2;
const usize TRAIN2 = 47;
const usize TRAIN3 = 54;
const usize TRAIN4 = 58;

TrackNode* node = track_node_by_name(track, "E8");
TrainstateSetPos(trainstate_server, reserve_server, TRAIN, node);
Path train1_paths[] = {(Path){TRAIN, SPEED, 0, "A14"}, (Path){TRAIN, SPEED, 0, "E8", true}};
Tid train1_pather = PlanPathSeq(train1_paths, 2);
TrainstateSetPos(trainstate_server, reserve_server, TRAIN1, track_node_by_name(track, "E9"));
TrainstateSetPos(trainstate_server, reserve_server, TRAIN2, track_node_by_name(track, "E14"));
TrainstateSetPos(trainstate_server, reserve_server, TRAIN3, track_node_by_name(track, "D14"));
TrainstateSetPos(trainstate_server, reserve_server, TRAIN4, track_node_by_name(track, "B1"));
TrainstateSetCohort(trainstate_server, TRAIN2, TRAIN1);
TrainstateSetCohort(trainstate_server, TRAIN3, TRAIN1);
TrainstateSetCohort(trainstate_server, TRAIN4, TRAIN1);

break;
}
Expand Down

0 comments on commit 095850f

Please sign in to comment.