fix stupid error w/ mode switch

daktil_thumb_popravljen
milestogo 2017-03-08 01:25:33 -08:00
parent 01980c96e9
commit 89aba30c7f
8 changed files with 51 additions and 25 deletions

View File

@ -19,7 +19,7 @@ uint8_t babble_mode =0 ;
macro_t* switch_babble_mode( uint8_t id) {
babble_mode= id;
return MACRO_NONE; //less typing above
return MACRO_NONE; //less typing where called
}
@ -42,12 +42,32 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) {
return MACRO_NONE;
}
*/
switch(babble_mode) {
#ifdef MS_MODE
if ( BABL_WINDOWS == shortcut ) { return switch_babble_mode(MS_MODE); }
#endif
#ifdef MAC_MODE
if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE); }
#endif
#ifdef LINUX_MODE
if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE); }
#endif
#ifdef READMUX_MODE
if ( BABL_READLINE == shortcut ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; }
#endif
#ifdef VI_MODE
if ( BABL_VI == shortcut ) { return switch_babble_mode(VI_MODE); }
#endif
#ifdef EMACS_MODE
if ( BABL_EMACS == shortcut ) { return switch_babble_mode(EMACS_MODE); }
#endif
switch(babble_mode) {
#ifdef MS_MODE
case MS_MODE:
BABLM( BABL_GO_LEFT_1C, T(LEFT), END );
@ -111,7 +131,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) {
#ifdef LINUX_MODE
if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE); }
case LINUX_MODE:
BABLM( BABL_GO_LEFT_1C , T(LEFT), END );
@ -172,7 +191,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) {
#endif
#ifdef MAC_MODE
if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE); }
case MAC_MODE:
BABLM( BABL_GO_LEFT_1C , T(LEFT), END );
@ -234,8 +252,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) {
#ifdef EMACS_MODE
if ( BABL_EMACS == shortcut ) { return switch_babble_mode(EMACS_MODE); }
case EMACS_MODE:
switch(shortcut) {
//probably should allow meta to not be ALT
@ -303,7 +319,6 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) {
#ifdef VI_MODE
if ( BABL_VI == shortcut ) { return switch_babble_mode(VI_MODE); }
case VI_MODE:
// you have to track the modes yourself. Otherwise motion is awful (bell, bell, bell)
@ -371,7 +386,8 @@ const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) {
#ifdef READMUX_MODE
// Readline command line editing + tmux windowing
// I havent decided how much to do readline and how much tmux
if ( BABL_READLINE == shortcut ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; }
case READMUX_MODE:
BABLM( BABL_GO_LEFT_1C , T(LEFT), END );

View File

@ -18,6 +18,9 @@ and jeebak & algernon's keymap
/* ***************************
// Uncomment any modes you want. Whatever mode = 0 will be the default on boot
// Expect to get errors if you comment a feature out and leave it in your keymap.
#define USE_BABLPASTE
//#define MS_MODE 0 // Windows.
//#define MAC_MODE 1
@ -26,6 +29,11 @@ and jeebak & algernon's keymap
//#define VI_MODE 4
//#define WORDSTAR_MODE 5
//#define READMUX 6 // Readline and tmux
// This removes everything but cursor movement
//#define BABL_MOVEMENTONLY
// and this just removes browser shortcuts
//#define BABL_NOBROWSER
****************************/
@ -130,7 +138,7 @@ enum {
};
// BUG, used to jump to babble functiion. Surely there is a way to calculate size of enum?
#define BABL_NUM_MACROS 48 + 4 // 48 + # of defined modes.
#define BABL_NUM_MACROS 48+4 // 48 + # of defined modes.
/* And all the shorthand keymap ready versions */
// First the mode switching macros

View File

@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER Microsoftplus
#define PRODUCT sculpt mobile
#define DESCRIPTION 6000
/* key matrix size */
@ -33,14 +32,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_COLS 18
#ifdef ASTAR
#define PRODUCT sculpt mobile astar
/*0 1 2 3 4 5 6 7 8 */
#define MATRIX_ROW_PINS {D7, C6, D4, D0, D1, D3, D2, E2}
/* A B C D E F G H I J K L M N O P Q R */
#define MATRIX_COL_PINS {B4, B5, E6, B7, B6, D6, C7, F7, F6, F4,F5, F1,F0, D5, B0, B1, B2, B3}
#else
#define PRODUCT sculpt mobile teensypp
/* 0 1 2 3 4 5 6 7 */
#define MATRIX_ROW_PINS { F7,F6,F4,F5,F3,F2,F1,F0}
/* A B C D E F G H I J K L M N O P Q R */

View File

@ -17,5 +17,5 @@ RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
ifndef QUANTUM_DIR
include ../../../../Makefile
include ../../../../../Makefile
endif

View File

@ -10,15 +10,15 @@
#ifdef USE_BABLPASTE
//define BabblePaste maps
// Windows.
#define MS_MODE 0
#define MAC_MODE 1
#define MAC_MODE 0
#define MS_MODE 1
//aka gnome+KDE
//#define LINUX_MODE 2
//#define EMACS_MODE 3
#define VI_MODE 4
//#define WORDSTAR_MODE 5
#define VI_MODE 3
// Readline and tmux
#define READMUX_MODE 6
#define READMUX_MODE 2
//#define WORDSTAR_MODE 5
#endif
// Uncomment if you need more free flash space

View File

@ -104,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
____, ____, ____, ____, ____, ____, ____, ____, ____, ____
),
/*
* |ESC | Win| MAC|RdLn| VI | | | | | | | | | | | |
* |ESC | MAC| Win|RdLn| VI | | | | | | | | | | | |
* -------------------------------------------------------------------------------'
* | | | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = |Bakspace| Del|
* ---------------------------------------------------------------------------
@ -192,6 +192,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
/* If this is in the range of BABL macros, call a separate function */
/* Any clever remapping with modifiers should happen here e.g. shift bablkey does opposite*/
#ifdef USE_BABLPASTE
if( id >= BABL_START_NUM && id < (BABL_START_NUM + BABL_NUM_MACROS ) ) {
if (record->event.pressed) { // is there a case where this isn't desired?
@ -201,6 +202,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
}
#endif
// MACRODOWN only works in this function
switch(id) {
case 0:

View File

@ -53,6 +53,6 @@ The Astar mini has all pins exposed , so you can do 18x8
If you want a speaker, LEDs &etc, you'll need to free up a pin. I recommend joining columns
R and L to the same pin.
Building - edit rules.mk to set ASTAR=1 or comment it out for teensy2++
Building - add ASTAR=1 to the compile line or leave out for teensy2++

View File

@ -1,10 +1,10 @@
#CFLAGS=-D ASTAR
## Project specific files
SRC= babblePaste.c
ifdef ASTAR
CFLAGS=-D ASTAR
OPT_DEFS += -DBOOTLOADER_SIZE=4096
MCU = atmega32u4
OPT_DEFS += -DCATERINA_BOOTLOADER
@ -40,7 +40,8 @@ BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE ?= no # Audio output on port C6
USB ?= /dev/cu.usbmodem1421
USB ?= /dev/cu.usbmodem14141
upload: build