Skip to content

Instantly share code, notes, and snippets.

@JDeeth
JDeeth / Cargo.toml
Created January 10, 2024 22:10
X-Plane Rust minimal example
[package]
name = "hello-rust"
version = "0.1.0"
edition = "2021"
[dependencies]
xplm = { git = "https://github.com/samcrow/rust-xplm", branch = "master" }
[profile.dev]
opt-level = 2

SimSig Interface Gateway

As of SimSig v5.21, Sep 2022.

Overview

The SimSig Interface Gateway is a STOMP interface for SimSig. A client can subscribe to receive notification of in-game events, and send some commands back to the game.

Messages sent

@JDeeth
JDeeth / Blinker.h
Created May 8, 2023 02:23
This is most of the source files for the ESP8266-based SimSig exploratory work I was doing a few months ago before getting distracted. (`Credentials.h` had my wifi details and SimSig username/password hardcoded. Don't do that. Use the WiFiManager library for ESP boards instead.) Very early days - you'll see it's hard-coded for Alrewas level cros…
#pragma once
#include <Ticker.h>
class Blinker {
public:
Blinker(float freq) : _interval{freq / 2} {}
void setup() {
_ticker.attach(_interval, [this] { this->_toggle(); });
}
bool blinkNow() const { return _lit; }
@JDeeth
JDeeth / clipboard_preloader.py
Created July 14, 2022 19:27
Clipboard preloader
import win32clipboard
def run(items = None):
"""Puts each (text) item onto the clipboard one by one
If items is not provided, will prompt for this to be pasted in
"""
if items is None:
items = []
@JDeeth
JDeeth / thread.md
Last active September 7, 2023 18:22
Best of PPrune ATC Humour (Merged)
@JDeeth
JDeeth / YY3641AH.md
Created September 8, 2018 16:08
YY3641AH 4-digit 7-segment LED display pinout

YY3641AH 4-digit 7-segment LED display pinout

Segments:

     A
   |===|
 F |   | B
   | G |
   |===|

E | | C

@JDeeth
JDeeth / 1_with_ppl.cpp
Last active May 8, 2018 02:20
X-Plane flight loop callback demo
// complete plugin using PPL
#include <cstring>
#include <memory>
#include <XPLMPlugin.h>
#include <XPLMUtilities.h>
#include <processor.h>
class Foo : PPL::Processor {
@JDeeth
JDeeth / command.cpp
Created April 12, 2018 18:39
Wrapper for X-Plane Command interface
#include "command.h"
Command::Command(XPLMCommandRef ref,
std::function<Outcome(Phase)> cb,
bool run_before_sim)
: ref_(ref), before_(run_before_sim ? 1 : 0), callback_(cb) {
XPLMRegisterCommandHandler(
ref_,
[](XPLMCommandRef, XPLMCommandPhase phase, void* vp) {
auto cmd = reinterpret_cast<Command*>(vp);
#include "openglsnippet.h"
#include <cstring>
#if APL == 1
#include <OpenGL/OpenGL.h>
#include <OpenGL/glu.h>
#elif IBM == 1
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@JDeeth
JDeeth / bad.cpp
Last active April 8, 2018 10:08
Static library
// IIRC it's a bit vague when this DataRef registers and gets destructed
PPL::DataRef<std::string> sim_build{"sim/version/sim_build_string"};
PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc) {
char name[] = "BadExample";
strcpy(outName, name); strcpy(outSig, name); strcpy(outDesc, name);
return 1;
}