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

refactor: holdUpMarker as basic trial to line up photodiode spot and … #509

Merged
merged 2 commits into from
Jul 16, 2024
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
2 changes: 1 addition & 1 deletion src/experiment/honeycomb.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export function buildHoneycombTimeline(jsPsych) {

const timeline = [
startProcedure,
countdownTrial,
preloadTrial,
countdownTrial,
instructionsTrial,
honeycombProcedure,
debriefTrial,
Expand Down
32 changes: 6 additions & 26 deletions src/experiment/trials/holdUpMarker.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
import htmlButtonResponse from "@jspsych/plugin-html-button-response";
import { LANGUAGE } from "../../config/main";
import { h1 } from "../../lib/markup/tags";
import { photodiodeGhostBox } from "../../lib/markup/photodiode";

import { config, LANGUAGE } from "../../config/main";
import { eventCodes } from "../../config/trigger";
import { pdSpotEncode, photodiodeGhostBox } from "../../lib/markup/photodiode";
import { div, h1, p } from "../../lib/markup/tags";

// TODO @brown-ccv #330: Custom extension for EEG - this is initializeTriggerBox
// TODO @brown-ccv #330: Need to ping the serial part - this isn't doing anything yet
// TODO @brown-ccv: Prevent user from pressing continue until pdSpotEncode finishes (need to use jsPsych.pluginAPI.setTimeout)
export const holdUpMarkerTrial = {
type: htmlButtonResponse,
stimulus: function () {
const eventMarkerMarkup = h1(LANGUAGE.trials.eventMarker.connected, {
style: "color: green;",
});
return div(eventMarkerMarkup);
},
prompt: function () {
let holdUpMarkerPrompt = p(LANGUAGE.trials.holdUpMarker);

// Conditionally add the photodiodeGhostBox
if (config.USE_PHOTODIODE) holdUpMarkerPrompt += photodiodeGhostBox;

return holdUpMarkerPrompt;
},
stimulus:
h1(LANGUAGE.trials.holdUpMarker) +
photodiodeGhostBox,
choices: [LANGUAGE.prompts.continue.button],
on_load: function () {
// Conditionally flash the photodiode when the trial first loads
if (config.USE_PHOTODIODE) pdSpotEncode(eventCodes.test_connect);
},
};
Loading