Skip to content

Commit

Permalink
Move strings into progmem and pass by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ-Koenig committed Nov 1, 2024
1 parent 769a17f commit e567e5a
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 109 deletions.
183 changes: 107 additions & 76 deletions Software/src/constants/copy/en-us.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,83 +3,114 @@

#include "structs/LanguageStruct.h"

static const String enUs_DeepThroatTrainerSync PROGMEM = "DeepThroat Sync";
static const String enUs_Error PROGMEM = "Error";
static const String enUs_GetHelp PROGMEM = "Get Help";
static const String enUs_GetHelpLine1 PROGMEM = "On Discord,";
static const String enUs_GetHelpLine2 PROGMEM = "or GitHub";
static const String enUs_Homing PROGMEM = "Homing";
static const String enUs_HomingTookTooLong PROGMEM =
"Homing took too long. Please check your wiring and try again.";
static const String enUs_Idle PROGMEM = "Initializing";
static const String enUs_InDevelopment PROGMEM =
"This feature is in development.";
static const String enUs_MeasuringStroke PROGMEM = "Measuring Stroke";
static const String enUs_NoInternalLoop PROGMEM =
"No display handler implemented.";
static const String enUs_Restart PROGMEM = "Restart";
static const String enUs_Settings PROGMEM = "Settings";
static const String enUs_SimplePenetration PROGMEM = "Simple Penetration";
static const String enUs_Skip PROGMEM = "Click to exit";
static const String enUs_Speed PROGMEM = "Speed";
static const String enUs_SpeedWarning PROGMEM =
"Decrease the speed to begin playing.";
static const String enUs_StateNotImplemented PROGMEM =
"State: %u not implemented.";
static const String enUs_Stroke PROGMEM = "Stroke";
static const String enUs_StrokeEngine PROGMEM = "Stroke Engine";
static const String enUs_StrokeTooShort PROGMEM =
"Stroke too short. Please check you drive belt.";
static const String enUs_Update PROGMEM = "Update";
static const String enUs_UpdateMessage PROGMEM =
"Update is in progress. This may take up to 60s.";
static const String enUs_WiFi PROGMEM = "Wi-Fi";
static const String enUs_WiFiSetup PROGMEM = "Wi-Fi Setup";
static const String enUs_WiFiSetupLine1 PROGMEM = "Connect to";
static const String enUs_WiFiSetupLine2 PROGMEM = "'Ossm Setup'";
static const String enUs_YouShouldNotBeHere PROGMEM = "You should not be here.";
static const String enUs_AdvancedConfiguration PROGMEM = "Advanced Settings";

// stroke engine progmem
static const String enUs_StrokeEngineDescriptions[] PROGMEM = {
"Acceleration, coasting, deceleration equally split; no sensation.",
"Speed shifts with sensation; balances faster strokes.",
"Sensation varies acceleration; from robotic to gradual.",
"Full and half depth strokes alternate; sensation affects speed.",
"Stroke depth increases per cycle; sensation sets count.",
"Pauses between strokes; sensation adjusts length.",
"Modifies length, maintains speed; sensation influences direction."};

static const String enUs_StrokeEngineNames[] PROGMEM = {
"Simple Stroke", "Teasing Pounding", "Robo Stroke", "Half'n'Half",
"Deeper", "Stop'n'Go", "Insist"};

static const String enUs_AdvancedConfigurationSettingNames[] PROGMEM = {
"Adv. Settings ReadMe", "Motor Direction", "Steps Per Revolution",
"Pulley Teeth", "Max Speed", "Rail Length",
"Rapid Homing", "Homing Sensitivity", "Reset to Defaults",
"Apply Settings"};

static const String enUs_AdvancedConfigurationSettingDescriptions[] PROGMEM = {
"Long press to edit. \nShort press to set value. \nChanges revert "
"unless applied.",
"Homing dir toggle. \nFull depth should be penetration end away from "
"OSSM Head.",
"Set to match your motor register or dip switch setting.",
"Specify the number of teeth on your pulley.",
"Speed limit in millimeters per second.",
"The length of your rail in millimeters.",
"(Future)Feature toggle to run a faster homing procedure",
"This is a multiplier against idle current. \nHigher value will "
"overcome more friction.",
"Restore settings to default and restart OSSM? \n Yes: Long press \n "
"No: Short press",
"Save changes and restart OSSM? \n Yes: Long press \n No: Short press"};

// English copy
static const LanguageStruct enUs = {
.DeepThroatTrainerSync = "DeepThroat Sync",
.Error = "Error",
.GetHelp = "Get Help",
.GetHelpLine1 = "On Discord,",
.GetHelpLine2 = "or GitHub",
.Homing = "Homing",
.HomingTookTooLong =
"Homing took too long. Please check your wiring and try again.",
.Idle = "Initializing",
.InDevelopment = "This feature is in development.",
.MeasuringStroke = "Measuring Stroke",
.NoInternalLoop = "No display handler implemented.",
.Restart = "Restart",
.Settings = "Settings",
.SimplePenetration = "Simple Penetration",
.Skip = "Click to exit",
.Speed = "Speed",
.SpeedWarning = "Decrease the speed to begin playing.",
.StateNotImplemented = "State: %u not implemented.",
.Stroke = "Stroke",
.StrokeEngine = "Stroke Engine",
.StrokeTooShort = "Stroke too short. Please check you drive belt.",
.Update = "Update",
.UpdateMessage = "Update is in progress. This may take up to 60s.",
.WiFi = "Wi-Fi",
.WiFiSetup = "Wi-Fi Setup",
.WiFiSetupLine1 = "Connect to",
.WiFiSetupLine2 = "'Ossm Setup'",
.YouShouldNotBeHere = "You should not be here.",
.StrokeEngineDescriptions = {
"Acceleration, coasting, deceleration equally split; no sensation.",
"Speed shifts with sensation; balances faster strokes.",
"Sensation varies acceleration; from robotic to gradual.",
"Full and half depth strokes alternate; sensation affects speed.",
"Stroke depth increases per cycle; sensation sets count.",
"Pauses between strokes; sensation adjusts length.",
"Modifies length, maintains speed; sensation influences direction."
},
.StrokeEngineNames = {
"Simple Stroke",
"Teasing Pounding",
"Robo Stroke",
"Half'n'Half",
"Deeper",
"Stop'n'Go",
"Insist"
},
.AdvancedConfiguration = "Advanced Settings",
.AdvancedConfigurationSettingNames = {
"Adv. Settings ReadMe",
"Motor Direction",
"Steps Per Revolution",
"Pulley Teeth",
"Max Speed",
"Rail Length",
"Rapid Homing",
"Homing Sensitivity",
"Reset to Defaults",
"Apply Settings"
},
.AdvancedConfigurationSettingDescriptions = {
"Long press to edit. \nShort press to set value. \nChanges revert unless applied.",
"Homing dir toggle. \nFull depth should be penetration end away from OSSM Head.",
"Set to match your motor register or dip switch setting.",
"", // "Specify the number of teeth on your pulley.",
"", // "Speed limit in millimeters per second.",
"", // "The length of your rail in millimeters.",
"", // "(Future)Feature toggle to run a faster homing procedure",
"", // "This is a multiplier against idle current. \nHigher value will overcome more friction.",
"", // "Restore settings to default and restart OSSM? \n Yes: Long press \n No: Short press",
"Save changes and restart OSSM? \n Yes: Long press \n No: Short press"
},
// Reference board < 2.3 cannot handle this many strings being defined without the memory bootloop issue.
// Refactor needed to reduce memory usage.

};
.DeepThroatTrainerSync = enUs_DeepThroatTrainerSync,
.Error = enUs_Error,
.GetHelp = enUs_GetHelp,
.GetHelpLine1 = enUs_GetHelpLine1,
.GetHelpLine2 = enUs_GetHelpLine2,
.Homing = enUs_Homing,
.HomingTookTooLong = enUs_HomingTookTooLong,
.Idle = enUs_Idle,
.InDevelopment = enUs_InDevelopment,
.MeasuringStroke = enUs_MeasuringStroke,
.NoInternalLoop = enUs_NoInternalLoop,
.Restart = enUs_Restart,
.Settings = enUs_Settings,
.SimplePenetration = enUs_SimplePenetration,
.Skip = enUs_Skip,
.Speed = enUs_Speed,
.SpeedWarning = enUs_SpeedWarning,
.StateNotImplemented = enUs_StateNotImplemented,
.Stroke = enUs_Stroke,
.StrokeEngine = enUs_StrokeEngine,
.StrokeTooShort = enUs_StrokeTooShort,
.Update = enUs_Update,
.UpdateMessage = enUs_UpdateMessage,
.WiFi = enUs_WiFi,
.WiFiSetup = enUs_WiFiSetup,
.WiFiSetupLine1 = enUs_WiFiSetupLine1,
.WiFiSetupLine2 = enUs_WiFiSetupLine2,
.YouShouldNotBeHere = enUs_YouShouldNotBeHere,
.StrokeEngineDescriptions = enUs_StrokeEngineDescriptions,
.StrokeEngineNames = enUs_StrokeEngineNames,
.AdvancedConfiguration = enUs_AdvancedConfiguration,
.AdvancedConfigurationSettingNames = enUs_AdvancedConfigurationSettingNames,
.AdvancedConfigurationSettingDescriptions =
enUs_AdvancedConfigurationSettingDescriptions};

#endif // OSSM_SOFTWARE_EN_US_H
66 changes: 33 additions & 33 deletions Software/src/structs/LanguageStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
#define OSSM_SOFTWARE_LANGUAGESTRUCT_H

struct LanguageStruct {
String DeepThroatTrainerSync;
String Error;
String GetHelp;
String GetHelpLine1;
String GetHelpLine2;
String Homing;
String HomingTookTooLong;
String Idle;
String InDevelopment;
String MeasuringStroke;
String NoInternalLoop;
String Restart;
String Settings;
String SimplePenetration;
String Skip;
String Speed;
String SpeedWarning;
String StateNotImplemented;
String Stroke;
String StrokeEngine;
String StrokeTooShort;
String Update;
String UpdateMessage;
String WiFi;
String WiFiSetup;
String WiFiSetupLine1;
String WiFiSetupLine2;
String YouShouldNotBeHere;
String StrokeEngineDescriptions[7];
String StrokeEngineNames[7];
String AdvancedConfiguration;
String AdvancedConfigurationSettingNames[10];
String AdvancedConfigurationSettingDescriptions[10];
const String& DeepThroatTrainerSync;
const String& Error;
const String& GetHelp;
const String& GetHelpLine1;
const String& GetHelpLine2;
const String& Homing;
const String& HomingTookTooLong;
const String& Idle;
const String& InDevelopment;
const String& MeasuringStroke;
const String& NoInternalLoop;
const String& Restart;
const String& Settings;
const String& SimplePenetration;
const String& Skip;
const String& Speed;
const String& SpeedWarning;
const String& StateNotImplemented;
const String& Stroke;
const String& StrokeEngine;
const String& StrokeTooShort;
const String& Update;
const String& UpdateMessage;
const String& WiFi;
const String& WiFiSetup;
const String& WiFiSetupLine1;
const String& WiFiSetupLine2;
const String& YouShouldNotBeHere;
const String (&StrokeEngineDescriptions)[7];
const String (&StrokeEngineNames)[7];
const String& AdvancedConfiguration;
const String (&AdvancedConfigurationSettingNames)[10];
const String (&AdvancedConfigurationSettingDescriptions)[10];
};

#endif // OSSM_SOFTWARE_LANGUAGESTRUCT_H

0 comments on commit e567e5a

Please sign in to comment.